[Blazor] NimbleSelect improperly inheriting from NimbleInputBase<string>

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

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp
Domain
frontend

Research direction

Start by locating the Blazor NimbleSelect component and its NimbleInputBase inheritance. Compare the preferred generic TValue approach with the current component API and the raw web component and Angular representation mentioned in the issue. Done means NimbleSelect supports non-string value types without unnecessary boxing and its existing behavior remains covered.

Written by the indexing model from the issue text.

Description

tech debt

🧹 Tech Debt

The NimbleSelect component shouldn't be forced into having a Value of type string, as this isn't the case for the raw web-component, nor its Angular representation.

Possible alternatives to the current implementation are:

  1. Change its inherited type from NimbleInputBase<string> to NimbleInputBase<object>

    Cons: Unnecessary boxing of values that are primitive types.

  2. Preferred approach Allow the NimbleSelect to specify the type parameter (i.e. NimbleSelect -> NimbleSelect<TValue>).

    Pros: No boxing of primitive values (i.e. when using something like NimbleSelect<double>)

    Cons: Presents generic API at the component level, which doesn't exist in other platform component APIs (e.g. Angular). (this does exist for Angular CVA, for example dialog close reason) NOTE: That said, this type of API might be expected for a C# developer.

Dominant language
TypeScript
Stars
39
Forks
14
Avg merge
1d 16h
Merged PRs (30d)
13

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.

More from ni/nimble

All issues in ni/nimble

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.