gristlabs / gristlabs/ts-interface-builder
Duplicated variables when doing `--inline-imports`
- Dominant language
- TypeScript
- Stars
- 138
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
TS source:
Car-type.ts
```
export interface Manufacturer {
name: string;
country: string;
heavyDutyTruckSpecialize: boolean;
..
}
export interface Car {
manufacturer: Manufacturer;
engine: string;
}
```
Bike-type.ts
```
export interface Manufacturer {
name: string;
country: string;
..
}
export interface Bike {
manufacturer: Manufacturer;
engine: string;
}
```
Vehicle-type.ts
```
import { CarType as Car } from './Car-type.ts'
import { BikeType as Bike } from './Bike-type.ts'
export interface Vehicle {
type: CarType | BikeType;
}
```
Above scenario is sketched out to brings out the idea of the possible problem. Building interface type from `Vehicle-type.ts` with `--inline-imports` will lead to having duplicated variable named Manufacturer being generated in the same type file because import alias was not respected.
Suggestion: Use the import alias a prefix to generated variable name.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the Vehicle-type.ts example with --inline-imports, using the Car-type.ts and Bike-type.ts inputs. Trace how imported interfaces and aliases are converted into the generated type file. Done means the generated output no longer declares duplicate Manufacturer variables and respects the import aliases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100