Integration with typescript appears to be broken when using latest deps
See original GitHub issueDescribe 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.
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: https://github.com/emotion-js/emotion/issues/1249
With the fix being to add emotion types to compilerOptions: https://github.com/emotion-js/emotion/issues/1249#issuecomment-494428888
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"
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (8 by maintainers)
Hey @DarrienG , we’re releasing Monday March 31 or Tuesday April 1. In the meantime you can try our prerelease package which is
@patternfly/react-core@^3.152.0
.Confirming it is still not fixed on the latest release.
My assumption is that the fix hasn’t been made into an official release yet.
Current latest version with the issue:
@patternfly/react-core@3.146.0