Is there a way to make Typescript smarter when implementing a class?

class AbstractClass {
testMethod: (a: string, b: number) => Promise<boolean>
testMethodTwo: (a: string, b: number) => Promise<boolean>
}

class TSClass implements AbstractClass {
async testMethod(a, b) { // no intellisense

return true
}
async testMethodTwo(a: string, b: number) {

return true
}
}
class AbstractClass {
testMethod: (a: string, b: number) => Promise<boolean>
testMethodTwo: (a: string, b: number) => Promise<boolean>
}

class TSClass implements AbstractClass {
async testMethod(a, b) { // no intellisense

return true
}
async testMethodTwo(a: string, b: number) {

return true
}
}
In short, I want to get Intellisense on testMethod without needing the explicit typing like on testMethodTwo. Context: I'm trying to (slowly) introduce Typescript to a legacy-ish codebase, and wanting to make it as easy as possible for the rest of the team to learn and move fast. It would be nice if I could lay out some scaffolding (AbstractClass) and get Intellisense without the team needing to know how to use TS syntax .
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server