Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const getTypeMismatchError = ({ filename, expected, actual }) => {
const cssModuleToInterface = (cssModuleKeys) => {
const interfaceFields = cssModuleKeys
.sort()
.map(key => ` '${key}': string;`)
.map(key => ` readonly '${key}': string;`)
.join('\n');

return `interface CssExports {\n${interfaceFields}\n}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ exports[`Can emit valid declaration with sourceMap 1`] = `
"// This file is automatically generated.
// Please do not change this file!
interface CssExports {
'composedClass': string;
'otherClass': string;
'someClass': string;
'validClass': string;
readonly 'composedClass': string;
readonly 'otherClass': string;
readonly 'someClass': string;
readonly 'validClass': string;
}
export const cssExports: CssExports;
export default cssExports;
Expand All @@ -18,10 +18,10 @@ exports[`Can emit valid declaration without sourceMaps 1`] = `
"// This file is automatically generated.
// Please do not change this file!
interface CssExports {
'composedClass': string;
'otherClass': string;
'someClass': string;
'validClass': string;
readonly 'composedClass': string;
readonly 'otherClass': string;
readonly 'someClass': string;
readonly 'validClass': string;
}
export const cssExports: CssExports;
export default cssExports;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ exports[`Can error on invalid declaration 1`] = `
// This file is automatically generated.
// Please do not change this file!
interface CssExports {
'classInBothFiles': string;
- 'classInBothFiles': string;
- 'classInTypeScriptFile': string;
+ 'classInCssFile': string;
+ readonly 'classInBothFiles': string;
+ readonly 'classInCssFile': string;
}
export const cssExports: CssExports;
export default cssExports;
Expand Down
10 changes: 5 additions & 5 deletions test/verify-valid-declaration/index.css.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// This file is automatically generated.
// Please do not change this file!
interface CssExports {
'hyphened-classname': string;
'otherClass': string;
'someClass': string;
'underscored_classname': string;
'validClass': string;
readonly 'hyphened-classname': string;
readonly 'otherClass': string;
readonly 'someClass': string;
readonly 'underscored_classname': string;
readonly 'validClass': string;
}
export const cssExports: CssExports;
export default cssExports;