摘要:
Let’s study a few examples of extends scenarios and see if we can figure out whether it will evaluate to true or false 64 extends number . . . Answer: 阅读全文
摘要:
keyof The keyof type query allows us to obtain type representing all property keys on a given interface. key can be string, number or Symbol. So what 阅读全文
摘要:
From source: https://www.typescript-training.com/course/intermediate-v1/03-modules/ Things can sometimes get a bit tricky when consuming CommonJS modu 阅读全文
摘要:
Stacking multiple things on an identifier interface Fruit { name: string mass: number color: string } const Fruit = { name: "banana", color: "yellow", 阅读全文
摘要:
`namespace` is manily for the left over from the days where we’d refer to libraries through a single global variable. With this in mind, let’s not giv 阅读全文
摘要:
When working with function parameters, we know that “inner scopes” have the ability to access “outer scopes” but not vice versa function receiveFruitB 阅读全文
摘要:
Assume we have the following code: interface HasId { id: string } interface Dict<T> { [k: string]: T } function listToDict<T>(list: T[]): Dict<T> { co 阅读全文
摘要:
Add to global commands Add #! /usr/bin/env node to index.js chmod +x index.js Run ./index.js to test. ln -s <full_path_to_index.js_file>/index.js /usr 阅读全文
摘要:
Our CLI can be run from anywhere on the system but we have a critical error. The script is trying to find a data.json file that is relative to where i 阅读全文