Skip to content

Integration with typescript appears to be broken when using latest deps #3824

@DarrienG

Description

@DarrienG

Describe the issue. What is the expected and unexpected behavior?

On the latest releases of patternfly/typescript, a number of components complain about the css property not being set.

2020-02-25-180051_1036x317_scrot

Error message in text:

Property 'css' is missing in type '{ children: string; variant: "primary"; }' but required in type 'Pick<ButtonProps & InjectedOuiaProps, "ref" | "cite" | "data" | "form" | "label" | "span" | "style" | "summary" | "title" | "pattern" | "children" | ... 359 more ... | "icon">'.  TS2741

I've done my due diligence here and tried to see if I can fix it myself and came across a number of related issues in other repos over the years.

The emotion repo is the most prominent that suffered from it a while ago: emotion-js/emotion#1249

With the fix being to add emotion types to compilerOptions: emotion-js/emotion#1249 (comment)

Adding:

"compilerOptions": {
    "types": ["@patternfly/react-core"]
}

Does not fix the issue.

I tried clearing my yarn.lock and node_modules and reinstalling and this did not fix either.

Please provide the steps to reproduce. Feel free to link CodeSandbox or another tool.

create-react-app test-issue --template typescript
yarn add @patternfly/react-core @patternfly/patternfly
# Add a button somewhere
yarn install && yarn start
# error

I've included a repo I made a few minutes ago to demonstrate the error here.

https://gitlab.com/DarrienG/ts-patternfly-issue

Is this a bug or enhancement? If this issue is a bug, is this issue blocking you or is there a work-around?

The only workaround I can see is not upgrading my deps.

What is your product and what release version are you targeting?

I've included the info in the repo, but these are the patternfly versions that have the issue:

    "@patternfly/patternfly": "2.65.3",
    "@patternfly/react-core": "3.140.11",

Using node 13.8.0, yarn v1.22.0 (all latest) on Ubuntu 19.10 (sorry not fedora).

Upgrading from "@patternfly/react-core": "3.134.2 and "typescript": "3.7.2" to "typescript": "3.7.4"

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions