You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In JSDoc types when a class with generic type T has a method that returns an instance of the same class but with the generic T[] it's return type will be inferred as T[][]. The same code written in plain TS will return the expected result.
π Expected behavior
It's expected that the JSDoc version of the code has the same output as the TS version for the method that returns an instance of the class with generic wrapped in T[].
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered:
π Search Terms
"jsdoc", "recursive", "inference", "generic"
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?filetype=js#code/PQKhFgCgAIWgBALgUwLYAcA2BDF0DaAKtALzTYB2AngLpSzBQDGOAzq9AMrQDeUUASFARIA2AkRV0yXp2SIAPIQB8AX0ENBreQG5+o4Rrjx02AE7ZUs+UrXRtiI41FMA9hVaIzAVyaJXZgAUDgCUvIICiAAWAJasAHQOpPa6guqQguYWVIFhfKICZvLeZhTQFMgA7lyBFdVyiIH48S3RcYnyNPGo2OiBMShWJMoEA2g0IZM60MDA0EWIJR5cSvg0ayMARt6I0MgAHtJ+yAAmK4Qb0ACEN2lQ6VCGMMaDWLgyRMmUtPTGphZWHgNWyqFKOZ7ONweXasACCZmyyWC8jCw3CogWS3KVRqdS48iaLQ6iC6PT6YyGI3wFImUxmc0xpQ4nFWNBG2A4ByOKBO9x0QA
π» Code
JS with JSDoc typing:
TS version:
Link to TS version: https://www.typescriptlang.org/play/?&filetype=ts#code/MYGwhgzhAEDKA8AVAfNA3gWAFDetCApgC4BccxSyA3NrtMAPYB2ERATgK7BENsAUhUuSKUAlOjp4iACwCWEAHSDoAXnzEaWPAF9aW6GDZswATz7jM+vG2Ic2TaEwIB3OHyevYxPgG0F-mXklYgBdBQBbMAAHPlkiAnDVVB84hJDRDKpoAHps6BsiOxY4JB8Q1EhoAgAPKIJuAgATOl0sVuwAMw4mbllmfABBI1NKAWIyLxEUCzoCoscXNw9hX39gojDImNTElWSd9MycvLn7GAREMoqYGrqG5raqIA
π Actual behavior
In JSDoc types when a class with generic type
T
has a method that returns an instance of the same class but with the genericT[]
it's return type will be inferred asT[][]
. The same code written in plain TS will return the expected result.π Expected behavior
It's expected that the JSDoc version of the code has the same output as the TS version for the method that returns an instance of the class with generic wrapped in T[].
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: