Reputation: 183
The !
character doesn't seem to be recognized when trying to compile the file.
If I do not use it, I get these errors(for context, not really important, I believe):
Point is, if I want to avoid those errors, I have to either use the non null assertion operator !
or to test whether or not these objects are null before using them.
Code runs like a charm using tests to verify the objects are not null, but for some reason, when trying to use the !
, I get that Unexpected token error. Any clue how that could be fixed?
I have added
module.exports = {
module:{
rules:[
{test: /\.ts$/, use: 'ts-loader'}
]
}
};
to my wepback.config.js
and now, I'm getting an Error:cannot find module 'typescript', Require stack:
error.
Upvotes: 1
Views: 240
Reputation: 183
npm install typescript --save-dev
fixed the problem.
I'm still courious why my globally installed typescript module(npm -i -g typescript
) didn't work, though.
Upvotes: 1