Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

TypeScript strictNullChecks compatibility #97

Open
BenoitZugmeyer opened this issue Jan 18, 2021 · 0 comments
Open

TypeScript strictNullChecks compatibility #97

BenoitZugmeyer opened this issue Jan 18, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@BenoitZugmeyer
Copy link

BenoitZugmeyer commented Jan 18, 2021

Is your feature request related to a problem? Please describe.

I want to use bumbag in a TS project configured with "strict": true or "strictNullChecks": true, but bumbag types are not compatible.

Describe the solution you'd like

Adjust bumbag types to be compatible with strictNullChecks.

Describe alternatives you've considered

I could also disable strictNullChecks in my project, but that's really not ideal.

Additional context

Please see this gist to reproduce the issue.

TS output:

node_modules/bumbag/ts/types/theme.d.ts:95:5 - error TS2411: Property 'default' of type '{ color: string; width: string; } | ((props: { theme: ThemeConfig; }) => { color: string; width: string; }) | undefined' is not assignable to string index type 'ThemeAttribute<{ color: string; width: string; }>'.

95     default?: ThemeAttribute<{
       ~~~~~~~

node_modules/bumbag/ts/types/theme.d.ts:105:5 - error TS2411: Property 'default' of type 'string | ((props: { theme: ThemeConfig; }) => string) | undefined' is not assignable to string index type 'ThemeAttribute<string>'.

105     default?: ThemeAttribute<string>;
        ~~~~~~~

node_modules/bumbag/ts/types/theme.d.ts:120:5 - error TS2411: Property 'importUrls' of type 'string[] | undefined' is not assignable to string index type 'string | string[]'.

120     importUrls?: Array<string>;
        ~~~~~~~~~~

node_modules/bumbag/ts/types/theme.d.ts:121:5 - error TS2411: Property 'default' of type 'string | undefined' is not assignable to string index type 'string | string[]'.

121     default?: string;
        ~~~~~~~

node_modules/bumbag/ts/types/theme.d.ts:122:5 - error TS2411: Property 'heading' of type 'string | undefined' is not assignable to string index type 'string | string[]'.

122     heading?: string;
        ~~~~~~~

node_modules/bumbag/ts/types/theme.d.ts:123:5 - error TS2411: Property 'mono' of type 'string | undefined' is not assignable to string index type 'string | string[]'.

123     mono?: string;
        ~~~~

node_modules/bumbag/ts/types/theme.d.ts:148:5 - error TS2411: Property 'minorUnit' of type 'number | ((props: { theme: ThemeConfig; }) => number) | undefined' is not assignable to string index type 'ThemeAttribute<string | number>'.

148     minorUnit?: ThemeAttribute<number>;
        ~~~~~~~~~

node_modules/bumbag/ts/types/theme.d.ts:149:5 - error TS2411: Property 'majorUnit' of type 'number | ((props: { theme: ThemeConfig; }) => number) | undefined' is not assignable to string index type 'ThemeAttribute<string | number>'.

149     majorUnit?: ThemeAttribute<number>;
        ~~~~~~~~~

node_modules/bumbag/ts/types/theme.d.ts:156:5 - error TS2411: Property 'modes' of type '{ [key: string]: PaletteThemeConfig; } | undefined' is not assignable to string index type 'string | { [key: string]: PaletteThemeConfig; }'.

156     modes?: {
        ~~~~~

node_modules/bumbag/ts/types/theme.d.ts:826:9 - error TS2411: Property 'info' of type 'string | undefined' is not assignable to string index type 'string'.

826         info?: string;
            ~~~~

node_modules/bumbag/ts/types/theme.d.ts:827:9 - error TS2411: Property 'warning' of type 'string | undefined' is not assignable to string index type 'string'.

827         warning?: string;
            ~~~~~~~

node_modules/bumbag/ts/types/theme.d.ts:828:9 - error TS2411: Property 'success' of type 'string | undefined' is not assignable to string index type 'string'.

828         success?: string;
            ~~~~~~~

node_modules/bumbag/ts/types/theme.d.ts:829:9 - error TS2411: Property 'danger' of type 'string | undefined' is not assignable to string index type 'string'.

829         danger?: string;
            ~~~~~~
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants