Skip to content
New issue

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

fix(types): expose legacy "types" folder in export alias #15123

Merged
merged 1 commit into from Oct 13, 2022

Conversation

anderson-arlen
Copy link

Description Of Problem

Imports of things like 'sequelize/types/hooks' (which is used by sequelize-typescript) is broken when using Typescript's "nodenext" or "node16" module resolution strategies. One could update the imports to 'sequelize/lib/hooks', but doing so breaks the default Typescript module resolution. So projects like sequelize-typescript can't easily make that change.

Currently anyone using the newer module resolution strategies along with sequelize-typescript have no upgrade path to a version of sequelize without the vulnerability mentioned in #14519

Description Of Change

This is a different approach to #14719.

Instead of adding hooks to the exports in index.d.ts, we can just add a "/types/" alias to the exports in package.json. Doing so allows imports of 'sequelize/types/hooks' to properly resolve using both older and newer Typescript module resolution strategies. In essence, importing /types/* will work as it always has regardless of module resolution strategy.

@WikiRik WikiRik requested a review from ephys October 13, 2022 06:24
@fzn0x
Copy link
Member

fzn0x commented Oct 13, 2022

Will the typings conflict?

Copy link
Member

@ephys ephys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this against a few configurations and it works, no conflicts, thank you :)

@ephys ephys changed the title feat: types export alias feat(types): expose legacy "types" folder in export alias Oct 13, 2022
@ephys ephys changed the title feat(types): expose legacy "types" folder in export alias fix(types): expose legacy "types" folder in export alias Oct 13, 2022
@ephys ephys merged commit 9dd93b8 into sequelize:v6 Oct 13, 2022
@github-actions
Copy link
Contributor

🎉 This PR is included in version 6.25.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@cage1618
Copy link

cage1618 commented Oct 14, 2022

Cannot find module './data-types' after update to 6.25.1 😭 @ephys

@ephys ephys mentioned this pull request Nov 5, 2022
2 tasks
@fzn0x
Copy link
Member

fzn0x commented Nov 5, 2022

Cannot find module './data-types' after update to 6.25.1 😭 @ephys

Hi, just in case someone looking up about this types issue, this is already fixed by ephys :), refer to latest v6, thank you!

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

Successfully merging this pull request may close these issues.

None yet

4 participants