danvk / effective-typescript Goto Github PK
View Code? Open in Web Editor NEWEffective TypeScript 2nd Edition: 83 Specific Ways to Improve Your TypeScript
Home Page: https://effectivetypescript.com
License: Other
Effective TypeScript 2nd Edition: 83 Specific Ways to Improve Your TypeScript
Home Page: https://effectivetypescript.com
License: Other
https://effectivetypescript.com/2020/03/24/null-values-to-perimeter/
Hey @danvk !
Thanks for the great book, just skimming through it, but already gotten great advice! I feel like there is a small error on page 72 (or I am to dumb? sorry if thats the case). It says:
number[] is a subtype of readonly number[]
The sentence directly after says (Its easy to get this backwards- remember Item 7!)
I don't get how number[]
is supposed to be a set with less possible values than readonly number[]
?
readonly number[] lacks push, pop, etc..
I think the correct sentence should be readonly number[] is a subtype of number[]
Effective TypeScript: All I Want for Christmas Is… These Seven TypeScript Improvements
Effective TypeScript: Welcome to Effective TypeScript!
Effective TypeScript: A TypeScript Perspective on Go: the 2021 Advent of Code
https://effectivetypescript.com/2022/02/06/advent-of-code-2021-golang/
ch05-any/item-40-hide-unsafe-casts/hide-unsafe-casts-04.ts
Maybe it would be better to change the name of the function to memorize
. cacheLast
always sounds confusing.
function cacheLast<T extends Function>(fn: T): T {
let lastArgs: any[]|null = null;
let lastResult: any;
return function(...args: any[]) {
if (!lastArgs || !shallowEqual(lastArgs, args)) {
lastResult = fn(...args);
lastArgs = args;
}
return lastResult;
} as unknown as T;
}
Is it better to use JSON.stringify(args)
instead of (lastArgs, args)
function?
Effective TypeScript: Use typed identity functions to guide type inference
https://effectivetypescript.com/2020/06/16/typed-identity-functions/
https://effectivetypescript.com/2020/08/12/generics-golden-rule/
Effective TypeScript: Exclusive Or and the Optional never Trick
Effective TypeScript: Generic Tips Part 1: Use Classes and Currying to create new inference sites
Effective TypeScript: Welcome to Effective TypeScript!
Effective TypeScript: Finding dead code (and dead types) in TypeScript
https://effectivetypescript.com/2020/11/05/template-literal-types/
Effective TypeScript: Unionize and Objectify: A Trick for Applying Conditional Types to Objects
https://effectivetypescript.com/2020/05/12/unionize-objectify/
Effective TypeScript: The Saga of the Closure Compiler, and Why TypeScript Won
https://effectivetypescript.com/2023/09/27/closure-compiler/
Effective TypeScript: The Making of a TypeScript Feature: Inferring Type Predicates
https://effectivetypescript.com/2024/04/16/inferring-a-type-predicate/
////
in ch-generics/template-dsl.mdindex.md
Effective TypeScript: TypeScript and SQL: Six Ways to Bridge the Divide
Hi Dan, thank you for the great book!
In Item 13, the NamedVariable
type is used as an example to explain how extending union types can be useful. But I don't get it. Could you show me some concrete use cases in which this type is useful? Thanks in advance!
Effective TypeScript: Now Available: Effective TypeScript, Second Edition
Effective TypeScript: What's TypeScript compiling? Use a treemap to find out.
https://effectivetypescript.com/2022/07/30/treemap-for-source-files/
Effective TypeScript: The display of types
https://effectivetypescript.com/2022/02/25/gentips-4-display/
Hi, I want to translate this into a Korean document, can I do it?
Effective TypeScript: A new way to test types
https://effectivetypescript.com/2022/05/28/eslint-plugin-expect-type/
Effective TypeScript: The Hidden Side of Type Predicates
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.