Skip to content

Duplicated variables when doing --inline-importsΒ #14

@lenowng

Description

@lenowng

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions