-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Open
Description
🔎 Search Terms
Related: #2576
2576 accessing static method from passed parameter variable -union
🕗 Version & Regression Information
This is the behavior in every version I tried through the playground, including the nightly, and I reviewed the FAQ for entries about static member access errors
⏯ Playground Link
💻 Code
class FafoTest1 {
name: string
fafo: Fafo1
constructor(name: string, fafo: Fafo1) {
this.name = name
this.fafo = fafo
}
test(): void {
console.log('testing test')
// Property 'test' does not exist on type 'Fafo1'. Did you mean to access the static member 'Fafo1.test' instead?(2576)
this.fafo.test()
}
}
class Fafo1 {
static get FafoTest1(): (name: string) => FafoTest1 {
return (name: string): FafoTest1 => {
const newInstance = new FafoTest1(name, Fafo1)
return newInstance
}
}
static test(): void {
console.log('test')
}
}🙁 Actual behavior
I received the following error:
Property 'test' does not exist on type 'Fafo1'. Did you mean to access the static member 'Fafo1.test' instead?(2576)
🙂 Expected behavior
I was not expecting an error, as the local field type is exactly the same.
Additional information about the issue
No response
Metadata
Metadata
Assignees
Labels
No labels