fix: add null protection for LowcodeTypes.shape (#1326)

* fix: add null protection for LowcodeTypes.shape, to solve the error with umijs/max >= 4.0.30
This commit is contained in:
AndyKim 2022-12-06 11:45:51 +08:00 committed by GitHub
parent 55c3fc9e58
commit 3fa810d8ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -113,7 +113,7 @@ LowcodeTypes.exact = (typesMap: any) => {
}; };
// An object taking on a particular shape // An object taking on a particular shape
LowcodeTypes.shape = (typesMap: any) => { LowcodeTypes.shape = (typesMap: any = {}) => {
const configs = Object.keys(typesMap).map(key => { const configs = Object.keys(typesMap).map(key => {
return { return {
name: key, name: key,

View File

@ -6,4 +6,8 @@ describe('parseMetadata', () => {
const md1 = parseMetadata('Div'); const md1 = parseMetadata('Div');
const md2 = parseMetadata({ componentName: 'Div' }); const md2 = parseMetadata({ componentName: 'Div' });
}); });
it('LowcodeTypes.shape', async () => {
const result = (window as any).PropTypes.shape()
expect(result).toBeDefined();
});
}); });