Going through the release notes of the latest vers...
# random
c
Going through the release notes of the latest version of Typescript, some features are real head scratchers:
Copy code
interface Config {
    [prop: string]: boolean;
}

declare const options: Config;

// Used to be an error, now allowed!
if (options.debugMode) {
    // ...
}
🍪 1
a
TS:
Copy code
declare const options: any;
if (options.debugMode) ...
TS.stricter:
Copy code
interface Config { debugMode: boolean }
declare const options: Config;
if (options.debugMode) ...
TS.stricter.relaxed:
Copy code
interface Config { [prop: string]: boolean }
declare const options: Config;
if (options["debugMode"]) ...
TS.stricter.relaxed.looksStricter:
Copy code
interface Config { [prop: string]: boolean }
declare const options: Config;
if (options.debugMode) ...
c
I understand the reason behind the index string type (and also the interesting
keyof
), I wonder if Kotlin will have to make similar sacrifices for its Javascript backend