【发布时间】:2017-01-30 09:58:20
【问题描述】:
Compiler Options page on Typescript website 列出了--alwaysStrict 选项,它应该告诉编译器在输出中发出“use strict”语句。
请注意,我正在使用 Visual Studio Code。
我在tsconfig.json 中添加了该选项:
{
"compilerOptions": {
"alwaysStrict": true,
//... blah blah ...
但我在尝试构建时收到Unknown compiler option 'alwaysStrict'。
所以,我运行 tsc 并看到该选项未列出,这是从 cmd 复制粘贴的输出:
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)
我错过了什么吗?
【问题讨论】:
标签: typescript tsc