2017-01-30 2 views
0

Compiler Options page on Typescript website--alwaysStrict 옵션을 나열합니다. 컴파일러에서 출력에 "use strict"문을 내 보내야한다고 말합니다.Typescript 컴파일러 옵션 alwaysStrict를 사용할 수 없습니까?

Visual Studio 코드에서 작업 중입니다.

나는 나의 tsconfig.json에 옵션을 추가 :

{ 
    "compilerOptions": { 
     "alwaysStrict": true, 
     //... blah blah ... 

그러나 구축 할 때 내가 Unknown compiler option 'alwaysStrict'를 얻을.

Version 2.0.9 
Syntax: tsc [options] [file ...] 

Examples: tsc hello.ts 
      tsc --outFile file.js file.ts 
      tsc @args.txt 

Options: 
--allowJs       Allow javascript files to be compiled. 
--allowSyntheticDefaultImports  Allow default imports from modules with no default export. This does not affect code emit, just typechecking. 
--allowUnreachableCode    Do not report errors on unreachable code. 
--allowUnusedLabels     Do not report errors on unused labels. 
--baseUrl       Base directory to resolve non-absolute module names. 
(blah blah, the rest of options alphabetically) 

내가 뭔가를 놓치고 있습니까 : 출력 cmd를 복사 - 붙여 넣기

그래서, tsc를 실행하고 옵션이 목록에없는 것을 볼, 여기?

답변

2

alwaysStrict 깃발은 What's new in TypeScript에서 볼 수있는 것처럼 버전 2.1에 추가되었습니다.

이 플래그를 사용하려면 입력 스크립트 버전을 업데이트하십시오.

+0

참고 사항 : 패키지의 버전을 항상 확인 ...'npm -g install typescript'를 실행했는데 이제는 2.1.5로 업그레이드되었고 옵션이 있습니다. – Alex

관련 문제