-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
area: typescriptoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: traverse (scope)
Description
💻
- Would you like to work on a fix?
How are you using Babel?
Programmatic API (babel.transform, babel.parse)
Input code
declare class Signal<T = any> {
value: T
}
function Signal(this: Signal, value?: unknown) {
this.value = value
}
export { Signal };Configuration file name
No response
Configuration
{
"presets": ["@babel/preset-typescript"]
}Current and expected behavior
Actual output:
function Signal(value) {
this.value = value;
}
export {};Expected output, see this TypeScript playground:
function Signal(value) {
this.value = value;
}
export { Signal };Basically there is a compilation difference between babel's TypeScript preset and TypeScript itself.
Environment
OS: macOS 12.5.1
Node: 18.8.0
Yarn: 1.22.17
@babel/core: 7.19.1
@babel/preset-typescript: 7.18.6
Monorepo: no
Possible solution
No response
Additional context
My assumption is that babel sees the declare class Signal {} line and tags it as a type-only thing or something like that.
Metadata
Metadata
Assignees
Labels
area: typescriptoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: traverse (scope)