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 d.ts errors generated by api-extractor #21945

Merged

Conversation

radium-v
Copy link
Contributor

@radium-v radium-v commented Mar 3, 2022

Current Behavior

The web-components.d.ts file generated by API Extractor contains errors, and I'm not really sure what caused them to appear:

image

Type '{ baseName: string; baseClass: TextArea; template: FoundationElementTemplate<ViewTemplate<TextArea, any>, FoundationElementDefinition>; styles: (context: any, definition: any) => ElementStyles; shadowOptions: { ...; }; }' does not satisfy the constraint 'FoundationElementDefinition'.
  Types of property 'baseClass' are incompatible.
    Type 'TextArea' is not assignable to type 'Constructable<{}>'.
      Type 'TextArea' provides no match for the signature 'new (...args: any[]): {}'.ts(2344)
Type '{ baseName: string; baseClass: TextArea; template: FoundationElementTemplate<ViewTemplate<TextArea, any>, FoundationElementDefinition>; styles: (context: any, definition: any) => ElementStyles; shadowOptions: { ...; }; }' does not satisfy the constraint 'FoundationElementDefinition'.
  Types of property 'baseClass' are incompatible.
    Type 'TextArea' is not assignable to type 'Constructable<{}>'.ts(2344)
Type '{ baseName: string; baseClass: TextField; template: FoundationElementTemplate<ViewTemplate<TextField, any>, TextFieldOptions>; styles: (context: any, definition: any) => ElementStyles; shadowOptions: { ...; }; }' does not satisfy the constraint 'FoundationElementDefinition'.
  Types of property 'baseClass' are incompatible.
    Type 'TextField' is not assignable to type 'Constructable<{}>'.
      Type 'TextField' provides no match for the signature 'new (...args: any[]): {}'.ts(2344)
Type '{ baseName: string; baseClass: TextField; template: FoundationElementTemplate<ViewTemplate<TextField, any>, TextFieldOptions>; styles: (context: any, definition: any) => ElementStyles; shadowOptions: { ...; }; }' does not satisfy the constraint 'FoundationElementDefinition'.
  Types of property 'baseClass' are incompatible.
    Type 'TextField' is not assignable to type 'Constructable<{}>'.ts(2344)

New Behavior

I cast the object passed to the compose() function for both TextArea and TextField as a FoundationElementDefinition, which is what it should default to. This is the most succinct solution I could find for these specific errors.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 3, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 99ab560:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

@fabricteam
Copy link
Collaborator

fabricteam commented Mar 3, 2022

📊 Bundle size report

🤖 This report was generated against 1f83caa61c5bea877ec67667ef748aaaf50ad14b

@size-auditor
Copy link

size-auditor bot commented Mar 3, 2022

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: 1f83caa61c5bea877ec67667ef748aaaf50ad14b (build)

@radium-v radium-v marked this pull request as draft March 4, 2022 20:36
@radium-v radium-v force-pushed the users/jokreitl/api-extractor-fixes branch from 5cfe62f to 99ab560 Compare March 4, 2022 22:24
Copy link
Member

@chrisdholt chrisdholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@radium-v do you want to open this beyond draft? Looks good to all of us :)

@radium-v radium-v marked this pull request as ready for review March 4, 2022 22:29
@chrisdholt chrisdholt merged commit 9d06110 into microsoft:master Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants