cloudflare / cloudflare/chanfana
TS error when setting docs_url/redoc_url/openapi_url to null
- Dominant language
- TypeScript
- Stars
- 767
- Forks
- 70
- Avg merge
- 25m
- Merged PRs (30d)
- 4
Description
The documentation for [docs_url](https://cloudflare.github.io/itty-router-openapi/user-guide/router-options/?h=docs_url) (and `redoc_url` and `openapi_url`) say the value can be `null` but getting ts error
> Type 'null' is not assignable to type 'string | undefined'
because the actual [types](https://github.com/cloudflare/itty-router-openapi/blob/89255c154a0421f7efb68b7d83d97b1964b8bc6a/src/types.ts#L12-L14) are
```
docs_url?: string;
redoc_url?: string;
openapi_url?: string;
```
Contributor guide
Research direction
Start with the declarations in src/types.ts, especially docs_url, redoc_url, and openapi_url, and compare them with the linked router-options documentation. The work is done when the documented null values are accepted by TypeScript for all three options and the existing type checks pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100