We're a place where coders share, stay up-to-date and grow their careers.
Some tips:
interface IProps { theme: Theme; } type CustomInputProps = HTMLAttributes<HTMLInputElement> & IProps;
type TListenerTypes = "onload" | "progress" | "error" const x: Record<TListenerTypes, Function> = { a: "something", // wrong type progress: () => {}, d: 10 // wrong type };
Regarding avoiding extends and just using union types: this is the kind of statement that definitely should be explained/quantified. Very easy for a beginner to see a comment like this and take it the wrong way.
The Record type is really cool! Definitely going to add that into the article. I'll have a look into the union types a bit, looks promising!
Some tips:
Regarding avoiding extends and just using union types: this is the kind of statement that definitely should be explained/quantified. Very easy for a beginner to see a comment like this and take it the wrong way.
The Record type is really cool! Definitely going to add that into the article. I'll have a look into the union types a bit, looks promising!