Microsoft/TypeScript
GitHub ã§èŠãNo duplicate identifier error issued if `const` declared with function type with expandos
Open
#57,985 opened on 2024幎3æ28æ¥
BugDomain: BinderHelp Wanted
Repository metrics
- Stars
- Â (48,455 stars)
- PR merge metrics
-  (å¹³åããŒãž 6d 17h) (30d ã§ 9 merged PRs)
説æ
ð 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