Skip to content

Fix the TypeScript type for the backgroundColor prop#451

Merged
sindresorhus merged 1 commit into
vadimdemedes:masterfrom
hmu332233:master
Jun 28, 2021
Merged

Fix the TypeScript type for the backgroundColor prop#451
sindresorhus merged 1 commit into
vadimdemedes:masterfrom
hmu332233:master

Conversation

@hmu332233

@hmu332233 hmu332233 commented Jun 27, 2021

Copy link
Copy Markdown
Contributor

Hello,
I read the issue(#428) and would like to suggest a solution to this

114594138-334df180-9c8d-11eb-8150-aef2cb6a6f96

Chalk's backgroundColor type is declared as follows.
https://github.com/chalk/chalk/blob/main/index.d.ts#L31-L49

export type BackgroundColor =
	| 'bgBlack'
	| 'bgRed'
	| 'bgGreen'
	| 'bgYellow'
	| 'bgBlue'
	| 'bgMagenta'
	| 'bgCyan'
	| 'bgWhite'
	| 'bgGray'
	| 'bgGrey'
	| 'bgBlackBright'
	| 'bgRedBright'
	| 'bgGreenBright'
	| 'bgYellowBright'
	| 'bgBlueBright'
	| 'bgMagentaBright'
	| 'bgCyanBright'
	| 'bgWhiteBright';

However, in ink, there is a code to attach bg prefix (https://github.com/vadimdemedes/ink/blob/master/src/colorize.ts#L8-L14),
so there is no need to attach bg.
Therefore, I suggest to use chalk's ForegroundColor type as auto-complete.

@sindresorhus sindresorhus changed the title Change auto-complete for backgroundColor props at Text Fix the TypeScript type for the backgroundColor prop Jun 28, 2021
@sindresorhus sindresorhus merged commit 7a3b32d into vadimdemedes:master Jun 28, 2021
@vadimdemedes

Copy link
Copy Markdown
Owner

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants