-
Notifications
You must be signed in to change notification settings - Fork 376
Closed
Labels
Description
As of TypeScript 4.7, the exports field can be respected when the new resolution (node16 or nodenext) is used. The Sass npm package uses exports but does not set the types condition. This results in d.ts resolution errors like the following:
Could not find a declaration file for module 'sass'. '/X/node_modules/sass/sass.default.dart.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/sass` if it exists or add a new declaration (.d.ts) file containing `declare module 'sass';`
3 import sass from 'sass';
One might wonder why this happens when the sass/package.json sets the types field. This field is ignored when the exports are configured and the default condition is pointing to the .js file, preventing .d.ts from being discovered.
The fix is to add another types condition that points to the index .d.ts file. This seems to require changing dart_cli_pkg to either add this per config-setting, or to merge the exports from the user-provided "base package.json` file.
Reactions are currently unavailable