Typescript definitions - extract types
See original GitHub issueThe types for common properties like align
, gap
, margin
etc. need to be extracted in a core types file. The current typescript implementation leads to code duplications, both in grommet itself and in the applications using grommet.
https://github.com/grommet/grommet/blob/9a2663082bb21bb5d4a947cedfdc769451c72522/src/js/components/Box/index.d.ts#L7
for example
export type GapProp = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | string;
export interface BoxProps { ... gap?: GapProp, ... }
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Documentation - Utility Types - TypeScript
Extract <Type, Union> Constructs a type by extracting from Type all union members that are assignable to Union .
Read more >How the TypeScript Extract Type Works
The Extract type lets us define a new list, and returns a new type if any items in that list exist in our...
Read more >How the TypeScript Extract Type Works - Fjolt
The TypeScript Extract utility type lets us check a union type for a specific members, and returns a new type based on what...
Read more >Types from Extraction
In this chapter we'll cover ways to express a type in terms of an existing type or value. Table of Contents. The typeof...
Read more >Is there a way to "extract" the type of TypeScript interface ...
Then y is a property of your I2 object, that is of a certain type, in that case "anonymous". You could use another...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you @taysea & @britt6612 for working on this issue! I’m closing the issue but let’s keep our eyes open to keep optimizing the typescript coding.
I opened one more PR (see above), but after that I think we can close this.