coreui / coreui/coreui-pro

Type Error in useColorModes Function

Open
#553 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
19
Forks
18
Avg merge
1h 6m
Merged PRs (30d)
549

Description

Description:
There is a type mismatch in the useColorModes function. The interface for setColorMode is defined as:

interface UseColorModesOutput {
  colorMode: string | undefined;
  isColorModeSet: () => boolean;
  setColorMode: Dispatch<SetStateAction<string>>;
}

However, the correct type should allow setColorMode to handle both string and undefined values. The interface should be updated as follows:

interface UseColorModesOutput {
  colorMode: string | undefined
  isColorModeSet: () => boolean
  setColorMode: Dispatch<SetStateAction<string | undefined>>
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search for the useColorModes function and its UseColorModesOutput interface; start by inspecting the current setter type and its callers. Update the setter type so it accepts string or undefined, then run the repository's type check to confirm the mismatch is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.