Skip to content
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

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

Open
RomainLanz opened this issue Jun 27, 2024 · 2 comments
Open

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

RomainLanz opened this issue Jun 27, 2024 · 2 comments
Assignees
Labels
Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files Recent Regression This is a new regression just found in the last major/minor version of TypeScript.

Comments

@RomainLanz
Copy link

RomainLanz commented Jun 27, 2024

πŸ”Ž 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

@RomainLanz
Copy link
Author

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

@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files Recent Regression This is a new regression just found in the last major/minor version of TypeScript. labels Jun 28, 2024
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 5.6.0 milestone Jun 28, 2024
@Max10240
Copy link

Max10240 commented Jun 28, 2024

met this too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files Recent Regression This is a new regression just found in the last major/minor version of TypeScript.
Projects
None yet
Development

No branches or pull requests

4 participants