We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
这是一个ts语言的相关bug,相关的issue也很多,但都还没有解决。
export const myname = () => {}
表现为:
const a = () => {}; export const b = () => {}; console.log(a.name === "a", b.name === "b", b.name === ""); // true false true
可以看到,如果是普通的箭头函数,则可以正确获取函数名;如果是被导出的箭头函数,则无法正确获取函数名。
因此,在此bug未被官方解决之前,建议使用export function来定义函数。同时,在tsconfig中添加noImplicitThis配置来防止this的滥用。
export function
noImplicitThis
The text was updated successfully, but these errors were encountered:
在deno的编码规范中,有一条:
Top level functions should not use arrow syntax.
https://github.com/denoland/deno/blob/master/docs/contributing/style_guide.md#top-level-functions-should-not-use-arrow-syntax
Sorry, something went wrong.
No branches or pull requests
这是一个ts语言的相关bug,相关的issue也很多,但都还没有解决。
export const myname = () => {}
functions have no name (according to React Devtools) microsoft/TypeScript#14127表现为:
可以看到,如果是普通的箭头函数,则可以正确获取函数名;如果是被导出的箭头函数,则无法正确获取函数名。
因此,在此bug未被官方解决之前,建议使用
export function
来定义函数。同时,在tsconfig中添加noImplicitThis
配置来防止this的滥用。The text was updated successfully, but these errors were encountered: