generated from mizdra/npm-package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
Status: BlockedProgress on the issue is BlockedProgress on the issue is BlockedType: FixFix bug.Fix bug.
Description
css-modules-kit uses paths to resolve import specifiers.
However, type checking of type definition files generated by codegen does not work properly.
// src/a.module.css
@import '@/d.module.css';// src/d.module.css
.d_1 { color: red; }// generated/a.module.css.d.ts
// @ts-nocheck
declare const styles = {
...(await import('@/src/d.module.css')).default,
// ^^^^^^^^^^^^^^^^^^
// This import speficier cannot be resolved by tsc.
// Therefore, the `(await import(...)) .default)` will be `any` type.
// Worse, `styles` will also be of `any` type.
};
export default styles;Since styles will be any type, a type error will not be reported if you reference a non-existent class name from *.ts.
// src/a.ts
import styles from './a.module.css';
styles.unknown; // This should be reported as a type error$ npx tsc
$ echo $?
0Additional Information
- The problem appears to be due to the following TypeScript behavior.
- The same problem occurs not only in
pathsoftsconfig.json, but also inimportsofpackage.json.
Metadata
Metadata
Assignees
Labels
Status: BlockedProgress on the issue is BlockedProgress on the issue is BlockedType: FixFix bug.Fix bug.
