carbon-design-system / carbon-for-ibm-dotcom

Carbon for IBM.com is based on the Carbon Design System for IBM
https://www.ibm.com/standards/carbon/
Apache License 2.0
243 stars 151 forks source link

[web-components] Issue with typings makes several components unusable #11828

Open vrg84 opened 1 month ago

vrg84 commented 1 month ago

Description

After including date-picker or search component from the @carbon/web-components package v2.9.0 we get a typescript error:

Error: node_modules/@carbon/web-components/es/components/text-input/text-input.d.ts:818:9 - error TS2611: 'value' is defined as a property in class '{ _getValidityMessage(state: string): string | undefined; _testValidity(): string; invalid: boolean; required: boolean; requiredValidityMessage: string; validityMessage: string; ... 301 more ...; focus(options?: FocusOptions | undefined): void; } & { ...; } & LitElement', but is overridden here in 'CDSTextInput' as an accessor.

818     get value(): string;

This seems to be the same error as the bug reported in the following closed issue: https://github.com/carbon-design-system/carbon-for-ibm-dotcom/issues/9744

But this issue is closed, while the error still occurs.

Component(s) impacted

Basically every web component that has a dependency with text-input has this issue. For us, it occurs when using the following web components:

import '@carbon/web-components/es/components/search/index.js';
import '@carbon/web-components/es/components/date-picker/index.js';

We are using:

Angular CLI: 17.3.8 Node: 20.12.2 Angular: 17.3.10 @carbon/web-components: 2.9.0

Package version


Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.8
@angular-devkit/build-angular   17.3.8
@angular-devkit/core            17.3.8
@angular-devkit/schematics      17.3.8
@angular/cli                    17.3.8
@schematics/angular             17.3.8
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.6

Browser

Chrome

Carbon for IBM.com version

2.9.0

Severity

Severity 1 = The design is broken in a critical way that blocks users from completing tasks or damages the brand. Affects major functionality, no workaround.

Application/website

angular

Package

@carbon/web-components

CodeSandbox example

https://codesandbox.io/p/devbox/carbon-web-components-issue-75vcgq

Steps to reproduce the issue (if applicable)

  1. Start an Angular project
  2. Include the @carbon/web-components library
  3. Import the datepicker component import '@carbon/web-components/es/components/date-picker/index.js';

Release date (if applicable)

No response

Code of Conduct

lukebrider-woolard-cgi commented 1 week ago

As a very temporary and risky workaround, I've set "skipLibCheck": true in the project's root tsconfig.json file.

As you mention, this affects all components that use the text-input component. For me, that's breaking the data-table component as well.