Teppei Sato
Teppei Sato
How about Closure Templates?
@TehShrike In the first case, you don't have to specify the template type. → [Playground code](https://www.typescriptlang.org/play/index.html#src=declare%20function%20deepmerge%3CT1%2C%20T2%3E(x%3AT1%2C%20y%3A%20T2)%3A%20T1%20%26%20T2%3B%0D%0A%0D%0Ainterface%20Whatever%20%7B%0D%0A%09important%3A%20string%2C%0D%0A%09info%3A%20string%2C%0D%0A%7D%0D%0A%0D%0A%2F%2F%20The%20inferred%20type%20is%20%60%7Bimportant%3A%20string%7D%20%26%20%7Binfo%3A%20string%7D%60%2C%0D%0A%2F%2F%20which%20is%20equivalent%20to%60Whatever%60.%0D%0Aconst%20merged%20%3D%20deepmerge(%0D%0A%09%7B%20important%3A%20'yes'%20%7D%2C%0D%0A%09%7B%20info%3A%20'okay'%20%7D%0D%0A)%0D%0A%0D%0A%2F%2F%20Also%20you%20specify%20%60Whatever%60%20type%20explicitly.%0D%0Aconst%20merged2%3A%20Whatever%20%3D%20deepmerge(%0D%0A%09%7B%20important%3A%20'yes'%20%7D%2C%0D%0A%09%7B%20info%3A%20'okay'%20%7D%0D%0A)%0D%0A) ```typescript declare function deepmerge(x:T1, y: T2): T1 & T2; interface Whatever { important: string,...
@RebeccaStevens It is not type safety because the generic type can receive any super classes (equivalent to casting). ```typescript const result = deepmerge({}, {}); console.log(result.a.toUpperCase()); // throw a runtime error...
@RebeccaStevens [The same error occurs](https://www.typescriptlang.org/play/index.html?esModuleInterop=true#code/CYUwxgNghgTiAEAzArgOzAFwJYHtX1BAAcBbEGAcxAB4AVABnhAA8MRVgBneWgRngBkPAEwAaHr3G1hAPgAUzAFwTxAT2XSAlBvoBuALAAoI1lRsYiKGAS14AbyPx4UZZwwxTFA4acAjAPyu7p7eAL5GYHhu8Bi8GvAAvPbOygBEiDg4qfCh3pGo0RjC8Ul2KfCpvrDZuUZGAPT1PAAWCKaI5HDAMapECDiI8AAGcJzIEBhD8FjcQ3Yu8G4eqBTivkHLFKFDog1NvsgYMa3OmMhQEPAAbhfIbbPzaVUwqdvwAO5YGM04h-BEMBwRGGviGADoIlEjqNxkckoRSOQqHJYuIippvHsYpwwAQcCBOKgAORHb6A97OVCqeCREhELAQBCdHAwThrP5QeAwNDYMhMGCAmDTbhknDvVAQwyNHi9EAAUQFLOUAGEoKhUDhoSAoN0AUDyBhqSScAAZMXkVWcEBE+ADeBoUCIUwgYCQgo4RlgiA4ChyGETMG+MEYU3mmCWkByTQYoxAA) as in the first example.
Thanks. I hope the feature! FYI: other static typing format - TypeScript: `{[index: string]: string}` - Closure Compiler: `Object` or `Object`
Why is HTML Imports of Firefox YELLOW? Why is "IE/Edge" combined?
[`listr`](https://github.com/SamVerschueren/listr) depends on `rxjs` v6 and is not maintained now. To update `rxjs` to v7, we need to replace `listr` with forked [`listr2`](https://github.com/cenk1cenk2/listr2).
Released in https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v20.0.0
Oh, sorry...
That difference between testing and documentation seems to have existed since the first implementation (https://github.com/typescript-eslint/typescript-eslint/commit/38abc282ec03b907ae0eac9fae962cf262c9f885) five years ago. I think this rule should report errors for the incorrect examples like...