Skip to content

[isolatedDeclarations] Optional parameter in arrow function typed as imported generic type gets emitted as anyΒ #59292

Closed
@MichaelMitchell-at

Description

@MichaelMitchell-at

πŸ”Ž Search Terms

isolated declarations transpiledeclarations any arrow

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

https://www.typescriptlang.org/play/?noCheck=true&isolatedDeclarations=true#code/JYWwDg9gTgLgBAbxgTzAUzgMQhAvnAMyghDgHICcyBuAKFrQA9JY4BjCAOwGd4AjAIZQ4AXjgAeACoAaAHwAKShAD8ALiw4psgJTqAbhGAATUbMS46QA

πŸ’» Code

import {type Foo} from 'foo';

export const bar = <T,>(foo?: Foo<T>): void => {};

πŸ™ Actual behavior

With "isolatedDeclarations": true this gets emitted as

export declare const bar: <T>(foo?: any) => void;

πŸ™‚ Expected behavior

This gets emitted as

import {type Foo} from 'foo';

export declare const bar: <T>(foo?: Foo<T>) => void;

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions