Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #11179
Closed
Open
Issue created Dec 22, 2021 by Administrator@rootContributor

Use type imports in typescript templates

Created by: wallw-teal

This is specifically for typescript-fetch, but may be applicable to all the TS templates:

The issue we are having is related to using preserveValueImports and isolatedModules in the TS config with TypeScript 4.5+. These are common config values for Svelte or Vue projects with TypeScript integration.

TS1444: 'ClassName' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled.

(where "ClassName" is a model or api class)

Basically, it is complaining that one of the imports is only used as a type (which is true), and therefore should be import type SomeType from ...; instead.

Describe the solution you'd like

I would like to see TS 3.8+ use type imports for imports which are only used as types.

Describe alternatives you've considered

I am currently looking into simply suppressing the warning for our generated code only. Additionally, it may be possible to post process the files and fix them.

I can potentially help out with a PR if the team is amenable to this change, but I am not familiar enough with the templating system to know whether there is sufficient information there to only modify the template or if a larger change would be necessary.

Assignee
Assign to
Time tracking