Skip to content

Instantly share code, notes, and snippets.

@richard-viney
Created October 11, 2019 05:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richard-viney/757366efa584cc7c3351d32eb11c293f to your computer and use it in GitHub Desktop.
Save richard-viney/757366efa584cc7c3351d32eb11c293f to your computer and use it in GitHub Desktop.
Type checking error upgrading from TypeScript 3.5 to 3.6
import EmberObject, { set } from "@ember/object"
class Foo extends EmberObject {
public version!: number
}
class Bar extends EmberObject {
public version!: number
public name!: string // Note: removing this line makes the error below go away
}
function test(a: Foo | Bar) {
// Global set type checks correctly, no problems here
set(a, "version", 1)
// But using .set() gives `error TS2349: This expression is not callable.`
a.set("version", 1)
}
@richard-viney
Copy link
Author

This is still happening with TypeScript 3.7.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment