Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the TypeScript type for the backgroundColor prop #451

Merged
merged 1 commit into from
Jun 28, 2021

Conversation

hmu332233
Copy link
Contributor

@hmu332233 hmu332233 commented Jun 27, 2021

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