Skip to content
This repository has been archived by the owner on Jun 1, 2020. It is now read-only.

Import issue: Cannot find name 'default' #123

Open
kdeyev opened this issue Dec 15, 2019 · 3 comments
Open

Import issue: Cannot find name 'default' #123

kdeyev opened this issue Dec 15, 2019 · 3 comments

Comments

@kdeyev
Copy link

kdeyev commented Dec 15, 2019

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
Copy link

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

@zhaoyao91
Copy link

zhaoyao91 commented Jan 20, 2020

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
Copy link

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'.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants