GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — TS 5.5 - Imports used by decorator output are removed · Issue #59051 · microsoft/TypeScript

TS 5.5 - Imports used by decorator output are removed #59051

New issue
Copy link
New issue
Copy link
Closed
#59325
Closed
TS 5.5 - Imports used by decorator output are removed#59051
#59325
Copy link
Assignees
jakebailey
Labels
BugA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesFix AvailableA PR has been opened for this issueRecent RegressionThis is a new regression just found in the last major/minor version of TypeScript.
Milestone
TypeScript 5.5.4

Description

@RomainLanz
Romain Lanz (RomainLanz)
opened on Jun 27, 2024
Issue body actions

🔎 Search Terms

remove import compilation decorator

🕗 Version & Regression Information

  • This changed between versions 5.4 and 5.5

⏯ Playground Link

https://github.com/RomainLanz/typescript-output-issue

npm install
npm run build

💻 Code

import { DateTime } from "luxon";
import { column } from "@adonisjs/lucid/orm";

class User {
  @column.dateTime()
  declare createdAt: DateTime;
}

🙁 Actual behavior

When compiled the DateTime import is being removed (because it is only used as a type in our file), but the compilation of @column.dateTime() will use the import.

// ...

import { column } from "@adonisjs/lucid/orm";
class User {
}
__decorate([
    column.dateTime(),
    __metadata("design:type", typeof (_a = typeof DateTime !== "undefined" && DateTime) === "function" ? _a : Object)
], User.prototype, "createdAt", void 0);

🙂 Expected behavior

The import should be kept like in TypeScript 5.4.

import { DateTime } from "luxon";
import { column } from "@adonisjs/lucid/orm";
class User {
}
__decorate([
    column.dateTime(),
    __metadata("design:type", typeof (_a = typeof DateTime !== "undefined" && DateTime) === "function" ? _a : Object)
], User.prototype, "createdAt", void 0);

Additional information about the issue

No response

Reacted by Matt Strayer, Max, Mikey Stengel, Fernando IL, Simone, Banashek, François Loupias, zanminkian and Shahriar

Activity

  1. RomainLanz commented on Jun 27, 2024

    @RomainLanz
    Romain Lanz (RomainLanz)
    on Jun 27, 2024
    Author
    More actions

    Here is a discussion that may be related : #54493 (comment)

  2. Daniel Rosenwasser (DanielRosenwasser)
    added
    BugA bug in TypeScript
    Domain: Declaration EmitThe issue relates to the emission of d.ts files
    Recent RegressionThis is a new regression just found in the last major/minor version of TypeScript.
    on Jun 28, 2024
  3. Daniel Rosenwasser (DanielRosenwasser)
    assigned
    Ron Buckton (rbuckton)
    on Jun 28, 2024
  4. Daniel Rosenwasser (DanielRosenwasser)
    added this to the TypeScript 5.6.0 milestone on Jun 28, 2024
  5. Max10240 commented on Jun 28, 2024

    @Max10240
    Max (Max10240)
    on Jun 28, 2024
    More actions

    met this too

  6. zanminkian commented on Jul 17, 2024

    @zanminkian
    zanminkian (zanminkian)
    on Jul 17, 2024
    More actions

    That means a project which enables following features at the same time will be unusable under TS 5.5:

    1. enable both emitDecoratorMetadata and experimentalDecorators in tsconfig.
    2. use declare keyword for class properties.
    3. verbatimModuleSyntax is false.

    Some of my projects cannot upgrade to TS 5.5 too.

  7. jakebailey commented on Jul 17, 2024

    @jakebailey
    Jake Bailey (jakebailey)
    on Jul 17, 2024
    Member
    More actions

    Using https://www.npmjs.com/package/every-ts, this bisects to #58366. Wesley Wigham (@weswigham)

  8. jakebailey commented on Jul 17, 2024

    @jakebailey
    Jake Bailey (jakebailey)
    on Jul 17, 2024
    Member
    More actions

    It looks like this bit was added:

            if (location.flags & NodeFlags.Ambient) {
                return; // References within types and declaration files are never going to contribute to retaining a JS import
            }

    Which explicitly skips marking references for declare.

  9. Daniel Rosenwasser (DanielRosenwasser)
    modified the milestones: TypeScript 5.6.0, TypeScript 5.5.4 on Jul 17, 2024
  10. TypeScript Bot (typescript-bot)
    added
    Fix AvailableA PR has been opened for this issue
    on Jul 17, 2024
  11. Jake Bailey (jakebailey)
    closed this as completedin #59325on Jul 17, 2024
  12. Daniel Rosenwasser (DanielRosenwasser)
    assigned
    Jake Bailey (jakebailey)
    and unassigned
    Ron Buckton (rbuckton)
    on Jul 17, 2024
  13. microsoft
    locked as resolved and limited conversation to collaborators on Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @jakebailey
    Jake Bailey (jakebailey)

Labels

BugA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesFix AvailableA PR has been opened for this issueRecent RegressionThis is a new regression just found in the last major/minor version of TypeScript.

Type

No type

Projects

No projects

    Milestone

    • TypeScript 5.5.4

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.