Skip to content

mobx-undecorate problem with flow js nullable types #2792

@alexander-schranz

Description

@alexander-schranz

Intended outcome:

When I'm running:

npx mobx-undecorate

Inside our project Sulu CMS.

It errors with all files containing nullable object like:

handleChange = (value: Value, media: ?Media) => {
};

https://github.com/sulu/sulu/blob/b83b17d66493024af45664fde07a4b5e13196b9d/src/Sulu/Bundle/MediaBundle/Resources/js/containers/CKEditor5/plugins/InternalLinkPlugin/overlays/MediaInternalLinkTypeOverlay.js#L13

src/Sulu/Bundle/MediaBundle/Resources/js/containers/CKEditor5/plugins/InternalLinkPlugin/overlays/MediaInternalLinkTypeOverlay.js Transformation error (Unexpected token (13:41))

Actual outcome:

 ERR /Users/el/Sulu/sulu-develop.localhost/vendor/sulu/sulu/src/Sulu/Bundle/MediaBundle/Resources/js/containers/CKEditor5/plugins/InternalLinkPlugin/overlays/MediaInternalLinkTypeOverlay.js Transformation error (Unexpected token (13:41))
SyntaxError: Unexpected token (13:41)
    at Object._raise (/Users/el/.npm/_npx/1347/lib/node_modules/mobx-undecorate/node_modules/@babel/parser/src/parser/error.js:97:45)
    at Object.raiseWithData (/Users/el/.npm/_npx/1347/lib/node_modules/mobx-undecorate/node_modules/@babel/parser/src/parser/error.js:92:17)
    at Object.raise (/Users/el/.npm/_npx/1347/lib/node_modules/mobx-undecorate/node_modules/@babel/parser/src/parser/error.js:41:17)
    at Object.unexpected (/Users/el/.npm/_npx/1347/lib/node_modules/mobx-undecorate/node_modules/@babel/parser/src/parser/util.js:140:16)
    at Object.tsParseNonArrayType (/Users/el/.npm/_npx/1347/lib/node_modules/mobx-undecorate/node_modules/@babel/parser/src/plugins/typescript/index.js:866:18)
    at Object.tsParseArrayTypeOrHigher (/Users/el/.npm/_npx/1347/lib/node_modules/mobx-undecorate/node_modules/@babel/parser/src/plugins/typescript/index.js:870:23)
    at Object.parseConstituentType [as tsParseTypeOperatorOrHigher] (/Users/el/.npm/_npx/1347/lib/node_modules/mobx-undecorate/node_modules/@babel/parser/src/plugins/typescript/index.js:930:16)
    at Object.tsParseUnionOrIntersectionType (/Users/el/.npm/_npx/1347/lib/node_modules/mobx-undecorate/node_modules/@babel/parser/src/plugins/typescript/index.js:940:18)
    at Object.parseConstituentType [as tsParseIntersectionTypeOrHigher] (/Users/el/.npm/_npx/1347/lib/node_modules/mobx-undecorate/node_modules/@babel/parser/src/plugins/typescript/index.js:953:19)
    at Object.tsParseUnionOrIntersectionType (/Users/el/.npm/_npx/1347/lib/node_modules/mobx-undecorate/node_modules/@babel/parser/src/plugins/typescript/index.js:940:18)
    
Results:
446 errors
0 unmodified
9095 skipped
30 ok

How to reproduce the issue:

[email protected]:sulu/sulu.git
npx mobx-undecorate

Versions

As I when using npx it will use the latest mobx-undecorate version I think.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions