|
|
|
|
|
by hn_throwaway_99
1490 days ago
|
|
No, that's the entire point of my question. In Typescript (and Kotlin, as others have noted), the type system knows within the scope of that if statement that obj is a string, so it lets you call string-specific methods on obj withOUT introducing the new variable s. |
|