question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript definitions - extract types

See original GitHub issue

The 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:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ShimiSuncommented, Oct 22, 2019

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.

0reactions
tayseacommented, Oct 22, 2019

I opened one more PR (see above), but after that I think we can close this.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found