强制使用严格,即使它不存在于代码中
Use strict is enforced even though it's not present in code
我试图在我的 typescript 模块中访问 function.arguments
但出现错误:
'arguments' properties may not be accessed on strict mode functions
编译文件中甚至没有 'use strict'
。
这是我的 tsconfig.json 设置:
"noImplicitUseStrict": true,
"alwaysStrict": false,
"strict": true,
如果我删除 "noImplicitUseStrict": true
编译后的文件将有 use strict
所以设置是 def 在 typescript 端工作(可能?)。
搜索我编译的文件我找不到包含单词 "strict" 的单个文件。
我使用node编译js文件:node src/index.js
ES6 模块以严格模式执行。
来自 MDN Other differences between modules and standard scripts
Also, note that you might get different behavior from sections of
script defined inside modules as opposed to in standard scripts. This
is because modules use strict mode automatically.
我试图在我的 typescript 模块中访问 function.arguments
但出现错误:
'arguments' properties may not be accessed on strict mode functions
编译文件中甚至没有 'use strict'
。
这是我的 tsconfig.json 设置:
"noImplicitUseStrict": true,
"alwaysStrict": false,
"strict": true,
如果我删除 "noImplicitUseStrict": true
编译后的文件将有 use strict
所以设置是 def 在 typescript 端工作(可能?)。
搜索我编译的文件我找不到包含单词 "strict" 的单个文件。
我使用node编译js文件:node src/index.js
ES6 模块以严格模式执行。
来自 MDN Other differences between modules and standard scripts
Also, note that you might get different behavior from sections of script defined inside modules as opposed to in standard scripts. This is because modules use strict mode automatically.