You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ExportedDeclarations type union is missing the type BindingElement which can be returned when an export declaration uses object or array destructuring, for example:
// Export with object destructuring.exportconst{
foo,bar: baz,
...qux}={foo: "hello",bar: 42,quxA: 1,quxB: 2,quxC: 3}asconst;// Export with array destructuring.exportconst[aaa,bbb, ...[ccc,ddd]]=[1,2,3,4]asconst;
To Reproduce
import{Project}from"ts-morph";constproject=newProject({useInMemoryFileSystem: true});constsourceFile=project.createSourceFile("test.ts",`// Export with object destructuring.export const { foo, bar: baz, ...qux} = { foo: "hello", bar: 42, quxA: 1, quxB: 2, quxC: 3} as const;// Export with array destructuring.export const [aaa, bbb, ...[ccc, ddd]] = [1, 2, 3, 4] as const;`,);for(const[exportName,declarations]ofsourceFile.getExportedDeclarations()){for(constdeclarationofdeclarations){console.log({
exportName,kind: declaration.getKindName(),// All declarations are of kind `BindingElement`type: declaration.getType().getText(),});}}
Describe the bug
Version: 21.0.1
The
ExportedDeclarations
type union is missing the typeBindingElement
which can be returned when anexport
declaration uses object or array destructuring, for example:To Reproduce
Output:
Expected behavior
ExportedDeclarations
type union should include typeBindingElement
.Thank you for your time!
The text was updated successfully, but these errors were encountered: