Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in allowJs, hovering on function with nested generic parameter causes error: set property on undefined #23198

Closed
HerringtonDarkholme opened this issue Apr 6, 2018 · 0 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@HerringtonDarkholme
Copy link
Contributor

HerringtonDarkholme commented Apr 6, 2018

TypeScript Version: 2.8.1, next

Search Terms: allowJs undefined

Code
func.ts

interface ComponentOptions<V> {
  watch: Record<string, WatchHandler<any>>;
}
type WatchHandler<T> = (val: T) => void;
declare function extend(options: ComponentOptions<{}>): void;
export var vextend = extend

app.js

import {vextend} from './func'
// hover on vextend
export var a = vextend({
  watch: {
    data1(val) {
      this.data2 = 1
    },
    data2(val) { }
  }
})

tsconfig.json

{
  "compilerOptions": {
    "checkJs": true,
    "allowJs": true
  }
}

Expected behavior:

Hovering on vextend in app.js. No error should happen in Code's output panel.

Actual behavior:

Error:

Error processing request. Cannot set property 'typeParameters' of undefined
TypeError: Cannot set property 'typeParameters' of undefined
    at assignContextualParameterTypes (/project/node_modules/typescript/lib/tsserver.js:36049:38)
    at checkFunctionExpressionOrObjectLiteralMethod (/project/node_modules/typescript/lib/tsserver.js:36336:29)
  // .... Elided, full error report in gist below

Playground Link: https://gist.github.com/HerringtonDarkholme/0efdffb4c6ec576a7cd274cc1c5042a0

Related Issue: reduced from vuejs/vetur#751

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants