Ayfri
08/08/2021, 2:42 AMclass Test<T = string> {
readonly thing: T
}
const a = new Test() // this works
const b = new Test<number>() // this too
Nathan Bedell
08/08/2021, 2:59 AMJames Whitehead
08/08/2021, 4:31 AMT
can be a subclass of String
you could do
class Test<T : String> {}
Dave K
08/08/2021, 4:47 AMAyfri
08/08/2021, 2:21 PMdiesieben07
08/08/2021, 2:29 PMclass Test<T> { }
typealias DefaultTest = Test<String>
Not an ideal solution but the closest you can get until we have native support for this in the language.