Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR solves this issue about SCSS import. Resolves #38.
I was partly right: TypeScript can't find a definition file, which is why it complained. However, I was wrong to assume that I could solve it using one single global definition hack, like this:
The hack was a bad idea anyway; I couldn't leverage TypeScript's type checking if I do that.
With some researching, I found out this article on Medium:
How to use CSS Modules with TypeScript and webpack
It contains instructions on how to generate
.scss.d.ts
files from.scss
. With the definition files in place, the SCSS import issue is finally solved.Tech Details
The article was written on May 11, 2017, so it was over 2 years old. Things have changed, and here is the gist:
Install
typings-for-css-modules-loader
Change Webpack Config
Change the config in
config/webpack.config.js
like this:Rerun
After the changes, run
yarn start
again, and see the typing files generated. For example, forTask.module.scss
with this content:The typing file generated,
Task.module.scss.d.ts
, contains content like this:There you go! All the errors are gone, and I can get Intellisense now: