摘要:
const $: any = {} /** * Get the <button> element with the class 'continue' * and change its HTML to 'Next Step...' */ $("button.continue").html("Next 阅读全文
摘要:
Refer: https://www.cnblogs.com/Answer1215/p/15084496.html A string is a primitive value, and all primitive values are immutable. Q1: const a = "Fronte 阅读全文
摘要:
Problem when typing Dictionaries: type Dict<T> = { [K: string]: T } const d: Dict<string[]> = {} d.rhubarb.join(", ") // 💥 Even `d.rhubarb` is undefi 阅读全文
摘要:
Since TypeScript v4.2, we can do remapping by using `as` keyword type Colors = "red" | "green" | "blue" type ColorSelector = { [K in Colors as `select 阅读全文
摘要:
String in Javascript is immutable. Means that once they were created, they cannot be modified. This also means that simple operations like appending a 阅读全文
摘要:
type Statistics = { [K in `${"median" | "mean"}Value`]?: number } Mappiing a sub type: // let winFns: "setInterval" | "setTimeout" type winFns = Extra 阅读全文
摘要:
Main idea is enforce you to do type checking in catch block, because if you want to get Error stacktrace, the throw value should be an Error type, if 阅读全文
摘要:
This major convenience feature reduces the need for class field type annotations by inferring their types from assignments in the constructor. It’s im 阅读全文
摘要:
https://www.typescript-training.com/course/making-typescript-stick/03-recent-updates-to-typescript/#variadic-tuple-types Before V4, for type, it is po 阅读全文