divide typings XXXXStructure into XXXX-Getter-Structure and XXXX-setter-Structure
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 238
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
**Is your feature request related to a problem? Please describe.**
I want to modify my code such as this :
```
const node:ImportDeclaration;
const struture:ImportDeclarationStructure = node.getStructure();
// modify structure to structure2
node.setStructure( structure2);
```
here is ImportDeclarationStructure 's typings :
```
interface ImportDeclarationSpecificStructure extends KindedStructure {
defaultImport?: string;
namespaceImport?: string;
namedImports?: (OptionalKind | string | WriterFunction)[] | WriterFunction;
moduleSpecifier: string;
}
```
so when I modify ```namedImports``` , it maybe " WriteFunction , so I cannot write this code :
```
if (structure.namedImports){
structure.namedImports.map((v)=>v.name) // type-checker error because of namedImports maybe WriteFunction
}
```
But we know , "getter structure" should not be WriteFunction .
**Describe the solution you'd like**
divide XXXStructure into XXXX-Getter-Structure and XXXX-setter-Structure
```
interface XXXX-Getter-Structure {
namedImport : string[] | undefined
}
interface XXXX-Setter-Strcture extends XXXX-Getter-Structure {
namedImport : string[] | undefined | WriteFunction
}
```
**Describe alternatives you've considered**
Contributor guide
Assessment
This issue has not been assessed yet.