cybertec-postgresql / rjsf-material-ui

[Archived] Material UI theme for react-jsonschema-form.
https://cybertec-postgresql.github.io/rjsf-material-ui/
MIT License
62 stars 25 forks source link

Import issue: Cannot find name 'default' #123

Open kdeyev opened 4 years ago

kdeyev commented 4 years ago

Hi,

I have an issue when I import the package into my code: import {MuiForm as Form} from 'rjsf-material-ui';

npm prints errors like: ERROR in [at-loader] ./node_modules/rjsf-material-ui/dist/index.d.ts:11:10 TS2304: Cannot find name 'default'.

Do you have any idea what is wrong? Thank you!

FunkMonkey commented 4 years ago

I see the same error. When building the package itself the dist folder is different compared to the version published on NPM...

zhaoyao91 commented 4 years ago

the dist/index.d.ts is

import { FieldProps, FieldTemplateProps, ObjectFieldTemplateProps, ThemeProps } from "react-jsonschema-form";
declare const DescriptionField: ({ description }: FieldProps<any>) => JSX.Element | null;
declare const TitleField: ({ title }: FieldProps<any>) => JSX.Element;
declare const FieldTemplate: ({ id, children, displayLabel, rawErrors, rawHelp, rawDescription, }: FieldTemplateProps) => JSX.Element;
declare const ObjectFieldTemplate: ({ DescriptionField, description, TitleField, title, properties, required, uiSchema, idSchema, }: ObjectFieldTemplateProps<any>) => JSX.Element;
declare const Theme: ThemeProps;
/// <reference types="react-jsonschema-form" />
/// <reference types="react" />
declare const MuiForm: import("react").ComponentClass<import("react-jsonschema-form").FormProps<any>, any> | import("react").FunctionComponent<import("react-jsonschema-form").FormProps<any>>;
export default MuiForm;
export { default as Fields };
export { default as FieldTemplate };
export { default as MuiForm };
export { default as ObjectFieldTemplate };
export { default as Theme };
export { default as Widgets };

which is totally invalid.

Currently a workaround is to import from rjsf-material-ui/dist/rjsf-material-ui.esm.js instead of rjsf-material-ui. But I hope it could get fixed.

lygstate commented 4 years ago

also have such problem.

    ERROR in node_modules/rjsf-material-ui/dist/index.d.ts(11,10): error TS2304: Cannot find name 'default'.
    node_modules/rjsf-material-ui/dist/index.d.ts(12,10): error TS2304: Cannot find name 'default'.
    node_modules/rjsf-material-ui/dist/index.d.ts(13,10): error TS2304: Cannot find name 'default'.
    node_modules/rjsf-material-ui/dist/index.d.ts(14,10): error TS2304: Cannot find name 'default'.
    node_modules/rjsf-material-ui/dist/index.d.ts(15,10): error TS2304: Cannot find name 'default'.
    node_modules/rjsf-material-ui/dist/index.d.ts(16,10): error TS2304: Cannot find name 'default'.