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

Add TypeScript Definitions for Sass #10363

Merged
merged 3 commits into from Feb 3, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lint-staged.config.js
Expand Up @@ -14,7 +14,7 @@ module.exports = {
`git add ${escapedFileNames}`,
]
},
'**/*.{json,md,mdx,css,html,yml,yaml,scss,sass}': filenames => {
'**/*.{json,md,mdx,css,html,yml,yaml,scss}': filenames => {
const escapedFileNames = filenames
.map(filename => `"${isWin ? filename : escape([filename])}"`)
.join(' ')
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -23,8 +23,8 @@
"lint-eslint": "eslint . --ext js,jsx,ts,tsx --max-warnings=0",
"lint": "run-p lint-typescript prettier-check lint-eslint",
"lint-fix": "yarn prettier-fix && eslint . --ext js,jsx,ts,tsx --fix --max-warnings=0",
"prettier-check": "prettier --check \"**/*.{js,jsx,json,ts,tsx,md,mdx,css,html,yml,yaml,scss,sass}\"",
"prettier-fix": "prettier --write \"**/*.{js,jsx,json,ts,tsx,md,mdx,css,html,yml,yaml,scss,sass}\"",
"prettier-check": "prettier --check \"**/*.{js,jsx,json,ts,tsx,md,mdx,css,html,yml,yaml,scss}\"",
"prettier-fix": "prettier --write \"**/*.{js,jsx,json,ts,tsx,md,mdx,css,html,yml,yaml,scss}\"",
"types": "lerna run types --stream",
"typescript": "lerna run typescript",
"prepublish": "lerna run prepublish",
Expand Down
10 changes: 10 additions & 0 deletions packages/next/types/global.d.ts
Expand Up @@ -15,3 +15,13 @@ declare module '*.module.css' {
const classes: { readonly [key: string]: string }
export default classes
}

declare module '*.module.sass' {
const classes: { readonly [key: string]: string }
export default classes
}

declare module '*.module.scss' {
const classes: { readonly [key: string]: string }
export default classes
}
2 changes: 2 additions & 0 deletions test/integration/typescript/components/hello.module.sass
@@ -0,0 +1,2 @@
.hello
content: 'hello'
3 changes: 3 additions & 0 deletions test/integration/typescript/components/hello.module.scss
@@ -0,0 +1,3 @@
.hello {
content: 'hello';
}
4 changes: 4 additions & 0 deletions test/integration/typescript/components/hello.ts
@@ -1,6 +1,10 @@
import helloStyles from './hello.module.css'
import helloStyles2 from './hello.module.scss'
import helloStyles3 from './hello.module.sass'

export function hello(): string {
console.log(helloStyles.hello)
console.log(helloStyles2.hello)
console.log(helloStyles3.hello)
return 'Hello'
}
2 changes: 1 addition & 1 deletion test/integration/typescript/next.config.js
Expand Up @@ -3,5 +3,5 @@ module.exports = {
// Make sure entries are not getting disposed.
maxInactiveAge: 1000 * 60 * 60,
},
experimental: { css: true },
experimental: { scss: true },
}