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

SubmitField and ErrorsField throw in TypeScript #661

Closed
chmac opened this issue Dec 6, 2019 · 2 comments
Closed

SubmitField and ErrorsField throw in TypeScript #661

chmac opened this issue Dec 6, 2019 · 2 comments
Assignees
Labels
Type: Bug Bug reports and their fixes

Comments

@chmac
Copy link

chmac commented Dec 6, 2019

Foo.tsx
TypeScript error in Foo.tsx(13,10):
Property 'children' is missing in type '{}' but required in type '{ [x: string]: any; children: any; disabled?: any; inputRef?: any; label?: any; value?: any; }'.  TS2741

The typing that I see for the SubmitField from material is like so:

/// <reference types="react" />
declare const SubmitField: {
    ({ children, disabled, inputRef, label, value, ...props }: {
        [x: string]: any;
        children: any;
        disabled: any;
        inputRef: any;
        label: any;
        value: any;
    }, { uniforms: { error, state } }: {
        uniforms: {
            error: any;
            state: any;
        };
    }): JSX.Element;
    contextTypes: {
        uniforms: any;
    };
    defaultProps: {
        label: string;
        variant: string;
    };
};
export default SubmitField;

If I make all the parameters optional on the first example (by editing the definition file) then my error goes away. I'm not sure how these definition files are built, so I'm not sure where these changes could be made. I guess there's typing missing in the material SubmitField component...

@radekmie radekmie self-assigned this Dec 11, 2019
@radekmie radekmie added the Type: Bug Bug reports and their fixes label Dec 11, 2019
@radekmie radekmie added this to Needs triage in Open Source (migrated) via automation Dec 11, 2019
@radekmie
Copy link
Contributor

Hi @chmac. Indeed, currently inferred types are... Not suitable to work with. We'll try to do as much as possible now, but more general support will come with v3.

@chmac
Copy link
Author

chmac commented Dec 11, 2019

OK. Will wait to see how it works in v3. Right now I worked around the issue by just replacing the <SubmitField with a simple <Button. I don't have the whole lerna setup running for uniforms so won't be able to do much in terms of useful PRs.

radekmie added a commit that referenced this issue Dec 11, 2019
Open Source (migrated) automation moved this from Needs triage to Closed Dec 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug reports and their fixes
Projects
Archived in project
Development

No branches or pull requests

2 participants