Sceneario
- Project A
- This uses
typeScript@1.9.0-dev.20160409 with --noImplicitAny.
- This import the below project B via npm.
- Project B
- This uses
typeScript@1.9.0-dev.20160409 or before with --noImplicitAny.
- This is published as a npm packages
project-b with compiled code (*.js & *.d.ts).
Project A
import {Bar} from 'project-b';
const b = new Bar();
Project B
// index.ts
type Arg = {
a: number;
};
export class Bar {
private bar({ a, }: Arg): number {
return a;
}
}
is compiled:
// index.d.ts
export declare class Bar {
private bar({a});
}
export class Bar {
bar({ a, }) {
return a;
}
}
What happens (Actual Results)
Project A will be a compile error. The error log is here:
2 private bar({a});
~
project-b/index.d.ts(2,18): error TS7031: Binding element 'a' implicitly has an 'any' type.
Expected behavior
- TypeScript should emit a type signature of private members arguments of a exported object which uses destructuring assignment.
- I think this is most clear way.
- But this might have a compatibility risk with libraries compiled wirh ~TypeScript 1.8.
- ...or ignore a type signature of private members...
- As my personal opinion, I dont like it.
Sceneario
typeScript@1.9.0-dev.20160409with--noImplicitAny.typeScript@1.9.0-dev.20160409or before with--noImplicitAny.project-bwith compiled code (*.js&*.d.ts).Project A
Project B
is compiled:
What happens (Actual Results)
Project A will be a compile error. The error log is here:
2 private bar({a}); ~ project-b/index.d.ts(2,18): error TS7031: Binding element 'a' implicitly has an 'any' type.Expected behavior