-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Type inference with JSDoc, @template and curried functions #36201
Copy link
Copy link
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationRelates to JSDoc parsing and type generationDomain: check: Type InferenceRelated to type inference performed during signature resolution or `infer` type resolutionRelated to type inference performed during signature resolution or `infer` type resolutionEffort: DifficultGood luck.Good luck.Fix AvailableA PR has been opened for this issueA PR has been opened for this issueHelp WantedYou can do thisYou can do thischeckJsRelates to checking JavaScript using TypeScriptRelates to checking JavaScript using TypeScript
Milestone
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationRelates to JSDoc parsing and type generationDomain: check: Type InferenceRelated to type inference performed during signature resolution or `infer` type resolutionRelated to type inference performed during signature resolution or `infer` type resolutionEffort: DifficultGood luck.Good luck.Fix AvailableA PR has been opened for this issueA PR has been opened for this issueHelp WantedYou can do thisYou can do thischeckJsRelates to checking JavaScript using TypeScriptRelates to checking JavaScript using TypeScript
Issue Type: Bug
(I'm not completely sure this is the right place to report this bug, so point me to the correct place in case)
Let's take this JavaScript code:
The types that VSCode infers are:
All types are correct expect for
text3. In fact, if I look at the type instantiation for thecurriedFunctioncall, I get this:Now, it seems to me that the first
Tinstantiation is correctly bound tostring, but then the return value doesn't get itsTbound to the same template variable. Am I missing something, or this is the type that I should get?VS Code version: Code 1.41.1 (26076a4de974ead31f97692a0d32f90d735645c0, 2019-12-18T14:58:56.166Z)
OS version: Windows_NT x64 10.0.17134
System Info
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: enabled
rasterization: enabled
skia_renderer: disabled_off
surface_control: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off
webgl: enabled
webgl2: enabled
Extensions (5)