Visitar URL original
Include undefined in template value types by fly1d · Pull Request #88 · bramstein/url-template · GitHub
Skip to content

Include undefined in template value types - #88

Open
fly1d wants to merge 1 commit into
bramstein:mainfrom
fly1d:fix/undefined-values
Open

fly1d wants to merge 1 commit into
bramstein:mainfrom
fly1d:fix/undefined-values

Conversation

@fly1d

@fly1d fly1d commented Oct 29, 2026

Copy link
Copy Markdown

The bundled PrimitiveValue type excludes undefined, so strict TypeScript rejects optional fields and explicit undefined values that expand() already accepts. Include undefined in the alias to match the existing scalar, list and record handling.

The consumer fixture covers these inputs and keeps functions, symbols and deeper objects outside the accepted types. It produces six TS2322 errors with the original declaration and none with this change.

Fixes #79.

Checks:

  • TypeScript 5.9.3: tsc --strict --module NodeNext --target ES2022 --noEmit type-tests/expand.ts
  • npm test on Node 18.20.8: 159 tests pass, with no failures or skips, using the pinned URI-template test corpus.

The compiler fixture is checked separately from npm test; no compiler dependency or package script is added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

expand() context types do not allow undefined values even though the code implementation does

1 participant