Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

2.1.1 breaking changes on StatusCodes #54

Closed
johnhunter opened this issue Aug 24, 2020 · 1 comment
Closed

2.1.1 breaking changes on StatusCodes #54

johnhunter opened this issue Aug 24, 2020 · 1 comment

Comments

@johnhunter
Copy link

Migration notes indicate that api changes to StatusCodes are not breaking (but recommended).

In http-status-codes v1, Status Codes were exported directly from the top-level module. i.e. HttpStatus.OK. In v2 all Status Codes live under an object called StatusCodes. i.e. HttpStatus.StatusCodes.OK. We made this change to cater to TypeScript users who prefer a dedicated value with an enum type. The previous values are still exported, but we won't continue to update them. Please migrate if you're using the old-style imports.

However, with either of the following imports HttpStatus.UNAUTHORIZED throws a reference error:

import HttpStatus from 'http-status-codes'
// or
import { HttpStatus } from 'http-status-codes'

Whereas

import { StatusCodes as HttpStatus } from 'http-status-codes';

works as expected.

@prettymuchbryce
Copy link
Owner

prettymuchbryce commented Aug 24, 2020

Sorry about that. This should be resolved now in v2.1.2.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants