Skip to content

declare const instead of var #23

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

Merged
merged 1 commit into from
Aug 21, 2019
Merged
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 @@ -6,7 +6,7 @@ const LineDiff = require('line-diff');
const bannerMessage =
'// This file is automatically generated.\n// Please do not change this file!';

const cssModuleExport = 'declare var cssExports: CssExports;\nexport = cssExports;\n';
const cssModuleExport = 'declare const cssExports: CssExports;\nexport = cssExports;\n';

const getNoDeclarationFileError = ({ filename }) =>
new Error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface CssExports {
'someClass': string;
'validClass': string;
}
declare var cssExports: CssExports;
declare const cssExports: CssExports;
export = cssExports;
"
`;
Expand All @@ -23,7 +23,7 @@ interface CssExports {
'someClass': string;
'validClass': string;
}
declare var cssExports: CssExports;
declare const cssExports: CssExports;
export = cssExports;
"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`Can emit valid declaration without classes 1`] = `
interface CssExports {

}
declare var cssExports: CssExports;
declare const cssExports: CssExports;
export = cssExports;
"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports[`Can error on invalid declaration 1`] = `
- 'classInTypeScriptFile': string;
+ 'classInCssFile': string;
}
declare var cssExports: CssExports;
declare const cssExports: CssExports;
export = cssExports;


Expand Down
2 changes: 1 addition & 1 deletion test/verify-invalid-declaration/index.css.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ interface CssExports {
'classInBothFiles': string;
'classInTypeScriptFile': string;
}
declare var cssExports: CssExports;
declare const cssExports: CssExports;
export = cssExports;
2 changes: 1 addition & 1 deletion test/verify-valid-declaration/index.css.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ interface CssExports {
'underscored_classname': string;
'validClass': string;
}
declare var cssExports: CssExports;
declare const cssExports: CssExports;
export = cssExports;