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!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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!