Here is a very simple typescript code in a file test.ts
// Testing
//
class A {
private field1;
config;
constructor() {
this.field1 = undefined;
this.config = undefined;
}
};
function func() {
const config = new A();
return { config };
};
const { config: A } = func();
I used npx tsc test.ts
to compile the above, and I got these error messages
test.ts(3,7): error TS2300: Duplicate identifier 'A'.
test.ts(17,17): error TS2300: Duplicate identifier 'A'.
What is wrong with the code? Where does the duplicate come from?