We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Right now I have to use the enum StatusCodes to apply type to an property in Typescript like this:
StatusCodes
import { StatusCodes } from "http-status-codes"; export type Response = { code: StatusCodes; error: null | string; data: any; };
The problem with this approach is that enum type is not strict. You can apply anything to code & it won't throw an error.
enum
code
response.code = null; response.code = 99999; response.code = "big no";
Learn more about this problem :
enums
Providing a union type would be a big help for DX.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Right now I have to use the enum
StatusCodes
to apply type to an property in Typescript like this:The problem with this approach is that
enum
type is not strict.You can apply anything to
code
& it won't throw an error.Learn more about this problem :
enums
Suckenums
enum
typeProviding a union type would be a big help for DX.
The text was updated successfully, but these errors were encountered: