How to enable ts-check in es6
up vote
1
down vote
favorite
Recently I have found Visual Code has a nice feature for type checking in JavaScript files. All I have to do is to type on top of file // @ts-check
, it is great benefit for me, so I want to use it globally on every javascript file, how could I could i do it without writing that line every time on top of a file?
javascript reactjs typescript eslint
add a comment |
up vote
1
down vote
favorite
Recently I have found Visual Code has a nice feature for type checking in JavaScript files. All I have to do is to type on top of file // @ts-check
, it is great benefit for me, so I want to use it globally on every javascript file, how could I could i do it without writing that line every time on top of a file?
javascript reactjs typescript eslint
1
I believe that errors come from typescript compiler and not from eslint. To enable type checking in all js files add tsconfig.json file (if you don't have one) withcheckJs
compiler option enabled
– Aleksey L.
Nov 5 at 15:53
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Recently I have found Visual Code has a nice feature for type checking in JavaScript files. All I have to do is to type on top of file // @ts-check
, it is great benefit for me, so I want to use it globally on every javascript file, how could I could i do it without writing that line every time on top of a file?
javascript reactjs typescript eslint
Recently I have found Visual Code has a nice feature for type checking in JavaScript files. All I have to do is to type on top of file // @ts-check
, it is great benefit for me, so I want to use it globally on every javascript file, how could I could i do it without writing that line every time on top of a file?
javascript reactjs typescript eslint
javascript reactjs typescript eslint
edited Nov 10 at 11:13
asked Nov 5 at 15:30
Marius
4332926
4332926
1
I believe that errors come from typescript compiler and not from eslint. To enable type checking in all js files add tsconfig.json file (if you don't have one) withcheckJs
compiler option enabled
– Aleksey L.
Nov 5 at 15:53
add a comment |
1
I believe that errors come from typescript compiler and not from eslint. To enable type checking in all js files add tsconfig.json file (if you don't have one) withcheckJs
compiler option enabled
– Aleksey L.
Nov 5 at 15:53
1
1
I believe that errors come from typescript compiler and not from eslint. To enable type checking in all js files add tsconfig.json file (if you don't have one) with
checkJs
compiler option enabled– Aleksey L.
Nov 5 at 15:53
I believe that errors come from typescript compiler and not from eslint. To enable type checking in all js files add tsconfig.json file (if you don't have one) with
checkJs
compiler option enabled– Aleksey L.
Nov 5 at 15:53
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
As per Aleksey L. comment I added to root directory tsconfig.json
with this configuration and it works:
"compilerOptions":
"module": "system",
"noImplicitAny": false,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true,
"outDir": "./dist",
"rootDir": "./src",
"checkJs": true,
"allowJs": true,
"jsx": "react",
"experimentalDecorators": true,
"moduleResolution": "node"
,
"include": [
"src/**/*"
],
"exclude": [
"./node_modules",
"dist"
]
also if you want to check it with npm script
all you need is to install typescript
and use this command in scripts
section:
"typecheck": "tsc --project tsconfig.json --noEmit"
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
As per Aleksey L. comment I added to root directory tsconfig.json
with this configuration and it works:
"compilerOptions":
"module": "system",
"noImplicitAny": false,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true,
"outDir": "./dist",
"rootDir": "./src",
"checkJs": true,
"allowJs": true,
"jsx": "react",
"experimentalDecorators": true,
"moduleResolution": "node"
,
"include": [
"src/**/*"
],
"exclude": [
"./node_modules",
"dist"
]
also if you want to check it with npm script
all you need is to install typescript
and use this command in scripts
section:
"typecheck": "tsc --project tsconfig.json --noEmit"
add a comment |
up vote
0
down vote
accepted
As per Aleksey L. comment I added to root directory tsconfig.json
with this configuration and it works:
"compilerOptions":
"module": "system",
"noImplicitAny": false,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true,
"outDir": "./dist",
"rootDir": "./src",
"checkJs": true,
"allowJs": true,
"jsx": "react",
"experimentalDecorators": true,
"moduleResolution": "node"
,
"include": [
"src/**/*"
],
"exclude": [
"./node_modules",
"dist"
]
also if you want to check it with npm script
all you need is to install typescript
and use this command in scripts
section:
"typecheck": "tsc --project tsconfig.json --noEmit"
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
As per Aleksey L. comment I added to root directory tsconfig.json
with this configuration and it works:
"compilerOptions":
"module": "system",
"noImplicitAny": false,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true,
"outDir": "./dist",
"rootDir": "./src",
"checkJs": true,
"allowJs": true,
"jsx": "react",
"experimentalDecorators": true,
"moduleResolution": "node"
,
"include": [
"src/**/*"
],
"exclude": [
"./node_modules",
"dist"
]
also if you want to check it with npm script
all you need is to install typescript
and use this command in scripts
section:
"typecheck": "tsc --project tsconfig.json --noEmit"
As per Aleksey L. comment I added to root directory tsconfig.json
with this configuration and it works:
"compilerOptions":
"module": "system",
"noImplicitAny": false,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true,
"outDir": "./dist",
"rootDir": "./src",
"checkJs": true,
"allowJs": true,
"jsx": "react",
"experimentalDecorators": true,
"moduleResolution": "node"
,
"include": [
"src/**/*"
],
"exclude": [
"./node_modules",
"dist"
]
also if you want to check it with npm script
all you need is to install typescript
and use this command in scripts
section:
"typecheck": "tsc --project tsconfig.json --noEmit"
edited Nov 6 at 14:31
answered Nov 6 at 8:46
Marius
4332926
4332926
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53157373%2fhow-to-enable-ts-check-in-es6%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
I believe that errors come from typescript compiler and not from eslint. To enable type checking in all js files add tsconfig.json file (if you don't have one) with
checkJs
compiler option enabled– Aleksey L.
Nov 5 at 15:53