Microsoft/TypeScript
在 GitHub 查看No duplicate identifier error issued if `const` declared with function type with expandos
Open
#57,985 创建于 2024年3月28日
BugDomain: BinderHelp Wanted
仓库指标
- Star
- (48,455 star)
- PR 合并指标
- (平均合并 6天 17小时) (30 天内合并 9 个 PR)
描述
🔎 Search Terms
To be updated
🕗 Version & Regression Information
See playground link
⏯ Playground Link
💻 Code
interface Describable {
(s: string): boolean;
desc: string;
}
// let f: Describable = (s: string) => true;
const f: Describable = (s: string) => true;
console.log(f.desc);
f.desc = f.desc + '...more';
console.log(f.desc);
const f = 2;
let f = 3;
var f = '32e32';
"use strict";
// let f: Describable = (s: string) => true;
const f = (s) => true;
console.log(f.desc);
f.desc = f.desc + '...more';
console.log(f.desc);
const f = 2;
let f = 3;
var f = '32e32';
{
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"strictBindCallApply": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"alwaysStrict": true,
"esModuleInterop": true,
"declaration": true,
"target": "ES2017",
"jsx": "react",
"module": "ESNext",
"moduleResolution": "node"
}
}
Playground Link: Provided
🙁 Actual behavior
No errors
🙂 Expected behavior
Errors
Additional information about the issue
Also try with let by commenting line 7 and uncommenting line 6