Skip to content

feat: export StatusCode numeric literal union type - #113

Open
s1reyash wants to merge 1 commit into
prettymuchbryce:masterfrom
s1reyash:feat/status-code-union-type
Open

s1reyash wants to merge 1 commit into
prettymuchbryce:masterfrom
s1reyash:feat/status-code-union-type

Conversation

@s1reyash

Copy link
Copy Markdown

Closes #72.

Changes

  • Generate and export type StatusCode = 100 | 101 | ... in src/status-codes.ts via scripts/update-codes.ts.
  • Re-export StatusCode from src/index.ts.
  • Add a unit and @ts-expect-error type test in src/index.test.ts verifying valid numeric literals and StatusCodes enum members are accepted while invalid numbers/strings are rejected.

Verification

  • npx eslint src/index.ts src/index.test.ts (0 errors)
  • npm test (1 suite, 10/10 tests passed)
  • npm run build (passed)

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.

Provide an union of type StatusCode.

1 participant