Skip to content

tsconfig's verbatimModuleSyntax preserves type imports #1623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nea89o opened this issue Mar 12, 2025 · 0 comments
Open

tsconfig's verbatimModuleSyntax preserves type imports #1623

nea89o opened this issue Mar 12, 2025 · 0 comments

Comments

@nea89o
Copy link

nea89o commented Mar 12, 2025

With verbatimModuleSyntax set in tsconfig.json imports like:

import { type Side } from "SideTypes";

get preserved into

local ____SideTypes = require("SideTypes")
local Side = ____SideTypes.Side

The SideTypes module is declared like so:

/** @noSelfInFile **/

/** @noResolution */
declare module "SideTypes" {
  export type DefaultSideNames = ['bottom', 'top', 'back', 'front', 'right', 'left'];
  export type Side = (typeof import("sides"))[DefaultSideNames[number]]
}

/** @noResolution **/
declare module "sides" {
  import { type DefaultSideNames } from "SideTypes";
  const table: DefaultSideNames & {
    down: 0,
    negy: 0,
    bottom: 0,

    up: 1,
    posy: 1,
    top: 1,

    north: 2,
    negz: 2,
    back: 2,

    south: 3,
    posz: 3,
    forward: 3,
    front: 3,

    west: 4,
    negx: 4,
    right: 4,

    east: 5,
    posx: 5,
    left: 5,
  };

  export = table;
}

If i unset verbatimModuleSyntax to false, that import gets omitted, like expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant