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
interfaceDoSomething{(): number;}functiondoubleNumber(generator: DoSomething){returngenerator()*2;}functionreturn42(){return42;}console.log(doubleNumber(return42));classArbitraryNumber{constructor(privatereadonly_seed: number){}seed(): number{returnthis._seed;}}consttest=newArbitraryNumber(5);// this line will cause an error because *this* won't be defined inside of seed()console.log(doubleNumber(test.seed));
Expected behavior:
The typechecker complains because the implicit this isn't supplied when calling test.seed/i.e. you're forced to bind with an actual object.
Actual behavior:
This is a runtime error.
Playground Link: ! A link to a Playground "Share" link which demonstrates behavior
Search Terms:
method typechecking
Code
Expected behavior:
The typechecker complains because the implicit this isn't supplied when calling test.seed/i.e. you're forced to bind with an actual object.
Actual behavior:
This is a runtime error.
Playground Link: ! A link to a Playground "Share" link which demonstrates behavior
https://www.typescriptlang.org/play/index.html#code/JYOwLgpgTgZghgYwgAgCIHsDK6C2EwAWoA5sgN4CwAUMrcgBQCUAXMiAK44BG0A3NQF9q1GOxAIwwdCGQATdOy4AbCADlOPKPWIQQ0OGHRRWGbHkIlG5anWRR87KDJ16oBo02QAqZACZ+VEJUImISUjL2YI4gACy+npQ0dJHRyHEBQdQI0gDO6CoAdEroxPTyiirq3ND0KU5xjIwBWUpwOTnIAIJQXMBgblAAnlWa1km02SA5-ewSHgAOUMAAbgYo9nDyIEqDyAD6ORAQsqwc1VBWZMiZ48iHx0ynGtDkdg5OyBY5BQdHsrxBG6TaafCAggC8bAgAHcuj0+gNhs8tABWJpZXL5CBFEplBTKNTI+iQaYFe6yRrNYJUIA
Related Issues: ! Did find other bugs that looked similar?
The text was updated successfully, but these errors were encountered: