Isolated declarations allows return types that reference local expr or type #58558
Labels
Bug
A bug in TypeScript
Domain: Declaration Emit
The issue relates to the emission of d.ts files
Domain: Isolated Declarations
Related to the --isolatedDeclarations compiler flag
π Search Terms
π Version & Regression Information
5.5.0-dev.20240517
β― Playground Link
https://www.typescriptlang.org/play/?target=99&isolatedDeclarations=true&ts=5.5.0-dev.20240517#code/MYewdgzgLgBAHjAvDARCg3AKAKZwA4gBOsAZgK5jBQCW4M42AFAJQwDemMXMh2UZhMOwC+MAIYQYUAJ55sIEvCzDMOfEVIUqtIVADuIFu07dQkWNKSoMJrr36CR4yTLkKY05atwFiMcpQ0dFAAFrxMrBzcUrLYMABaVtCE1GAA5ljR9gJCbKISCV5AA
π» Code
π Actual behavior
No diagnostics are raised.
π Expected behavior
An isolated declarations error is raised for function
two
and functionthree
(missing explicit return type), because even though both return an "explicit" type (usingas
casting), neither can be emitted without using a type checker because the type / expression they reference are internal to the function.Additional information about the issue
I was looking for a case where this can happen top level, but I just ran into a different TypeScript error then: #58557
cc @dragomirtitian
The text was updated successfully, but these errors were encountered: