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 error with type Colors

See original GitHub issue
Failed to compile.

.../node_modules/grommet/themes/base.d.ts
TypeScript error in .../node_modules/grommet/themes/base.d.ts(34,3):
Property ''accent-1'' of type 'string | { dark?: string | undefined; light?: string | undefined; } | undefined' is not assignable to string index type 'ColorType'.  TS2411

    32 |   
    33 | type Colors = typeof colors & {
  > 34 |   'accent-1'?: ColorType;
       |   ^
    35 |   'accent-2'?: ColorType;
    36 |   'accent-3'?: ColorType;
    37 |   'accent-4'?: ColorType;

Expected Behavior

Compile Successfully

Actual Behavior

Failed to compile.

Steps to Reproduce

yarn start

Your Environment

  • Grommet version: 2.8.1
  • Typescript version: 3.7.2
  • React Version: 16.8.6

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rodrigopavezicommented, Dec 6, 2019

Issue has been fixed after upgrading the project to the latest create-react-app. Cheers

0reactions
jackielfucommented, Jan 14, 2020

was running into the same issue here:

TypeScript error in /app/src/App.tsx(17,20): Type '{ global: { colors: { brand: string; focus: string; placeholder: string; control: string; }; font: { family: string; size: number; }; input: { weight: number; padding: string; }; edgeSize: { small: string; }; }; ... 6 more ...; textArea: { ...; }; }' is not assignable to type 'ThemeType'.

turns out, we hadn’t added a typescript loader to our app. app now runs after following the instructions here: https://ricostacruz.com/til/babel-typescript

Read more comments on GitHub >

github_iconTop Results From Across the Web

Type error: Type 'string' is not assignable to type 'Colors'
I have a status component button that receives props of color and title, the color has different colors defined in typescript.
Read more >
Handbook - Interfaces - TypeScript
Did you mean 'color'?. // Error: Property 'clor' does not exist on type 'SquareConfig'. newSquare . color = config . clor ;. Property...
Read more >
TypeScript - Theme UI
export type ExactTheme = typeof theme. // No error. const lightBlue = theme.colors.blue.light. You can then reexport useThemeUI hook with narrowed type.
Read more >
TypeScript | WebStorm Documentation - JetBrains
Compilation errors are reported in the TypeScript tool window. ... When you type your code or paste a fragment with a symbol that...
Read more >
Typescript errors when setting color of PointGraphics
to: color: Color | Property | undefined; A similar issue occurs with BillBoardGraphics. Wrong type in typescript.
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