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

Typescript error with Input component: "Property 'css' is missing" #58

Open
danielp982 opened this issue Jun 7, 2021 · 4 comments
Open

Comments

@danielp982
Copy link

danielp982 commented Jun 7, 2021

  • windmill-react-ui version: 0.6.0

Relevant code or config:

(Simplified example. Typescript 4.2.4 is used.)

import { Input } from '@windmill/react-ui';

const TestComponent = () => (
  <>
    <Input />
  <>
);
export default TestComponent;

What you did:

We were trying to import the Input component from the Windmill React library. We have Typescript 4.2.4 embedded into our project and it gives us the following error: "Property 'css' is missing" (see screenshot for the full error message). This error persists regardless of what standard properties we include in the declaration (e.g. type="checkbox"). If we add the css property to the code and provide it any value: (e.g. <Input css="" />), the Typescript error disappears. As far as I'm aware an input component has never required or even included a css property.

What happened:

Relevant screenshot providing the full error message:
Screen Shot 2021-06-07 at 11 57 17 am

Problem description:

The current behaviour with Typescript doesn't match any of the documentation, and leaving it as is causes our builds to fail. To work around this issue we've created a wrapper component to mask the css property from the rest of our code (see below), but it would be nice not to have this workaround as I'm sure this isn't an intended behaviour.

import { Input } from '@windmill/react-ui';
import { InputProps } from '@windmill/react-ui/dist/Input';

const InputWrapper = (props: InputProps) => (
  <Input css={null} {...props} />
);

export default InputWrapper;

Suggested solution:

I found within Input.d.ts that the Input component is declared with a "css" property. Maybe this shouldn't be part of the declaration?

Note:

I would like to mention that we've really been enjoying the library so far! Keep up the great work.

@awesomeunleashed
Copy link

awesomeunleashed commented Jun 7, 2021

I looked into this as well a little bit ago. The css property is coming from Storybook; I tried compiling the library without Storybook, and the property was gone. I'm not sure how to resolve that (short of removing Storybook), though.

Select and (I believe) Textarea also have this issue.

@xerod
Copy link

xerod commented Jun 9, 2021

Confirm this happen on my machine too:

"dependencies": {
    "@windmill/react-ui": "^0.6.0",
}

image

there is this issue on the storybooks repo providing some temporary solution for their library (I've not tested it yet):
storybookjs/storybook#13436 (comment)

@deyanskiq
Copy link

It's happening regardless of Storybook usage. Any update?

awesomeunleashed pushed a commit to cast-corp/windmill-react-ui that referenced this issue Sep 15, 2021
@awesomeunleashed
Copy link

Adding "src/stories" to exclude in tsconfig.json would fix this issue. I don't know if it would negatively affect Storybook users, though, as I am not one.

ngduc added a commit to ngduc/windmill-react-ui-kit that referenced this issue Jan 21, 2022
awesomeunleashed pushed a commit to cast-corp/windmill-react-ui that referenced this issue Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants