【发布时间】:2019-06-06 20:37:59
【问题描述】:
我正在尝试在我的 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,所以设置在打字稿端正常工作(可能?)。
搜索我的编译文件,我找不到包含“严格”一词的单个文件。
我使用节点编译js文件:node src/index.js
【问题讨论】:
-
呃,既然可以直接访问
arguments对象,为什么还要使用function.arguments? (尽管在 ES6 中你更可能只使用 rest 参数) -
模块和类是严格的。可能还有其他地方。
标签: javascript typescript es6-modules strict