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

Transpile error using 3rd party library (xState) #1547

Open
@mapicard

Description

@mapicard

Hi,
I am trying to use a 3rd party library (xState) with Ionic3.
Running it on Stackblitz is fine https://i3-xstate.stackblitz.io
To build it locally I did

ionic start i3-xstate tabs --type=ionic-angular
npm install xstate --save
ionic cordova emulate browser

get a transpile error

[2K�[GRunning app-scripts build: --platform browser --target cordova
[16:10:28]  build dev started ... 
[16:10:28]  clean started ... 
[16:10:28]  clean finished in 1 ms 
[16:10:28]  copy started ... 
[16:10:29]  deeplinks started ... 
[16:10:29]  deeplinks finished in 26 ms 
[16:10:29]  transpile started ... 
            '{' or ';' expected. 

      L89:  matches<TSV extends TTypestate['value']>(parentStateValue: TSV): this is TTypestate extends {
      L90:      value: TSV;

            Unexpected token. A constructor, method, accessor, or property was expected. 

      L89:  matches<TSV extends TTypestate['value']>(parentStateValue: TSV): this is TTypestate extends {
      L90:      value: TSV;

            Declaration or statement expected. 

      L90:          value: TSV;

according to Ionic documentation I tried the following

npm install @types/xstate --save
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@types%2fxstate - Not found
npm ERR! 404 
npm ERR! 404  '@types/xstate@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

How can I troubleshoot transpile errors and how can I make this work when building locally for various platform?

You can find the sample code at https://github.com/mapicard/i3-xstate

$ ionic info

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.3
    ionic (Ionic CLI) : 3.20.1

global packages:

    cordova (Cordova CLI) : 9.0.0 ([email protected]) 

local packages:

    @ionic/app-scripts : 3.2.4
    Cordova Platforms  : browser 6.0.0
    Ionic Framework    : ionic-angular 3.9.9

System:

    ios-deploy : 1.9.2 
    Node       : v12.14.1
    npm        : 6.14.1 
    OS         : macOS High Sierra
    Xcode      : Xcode 10.3 Build version 10G8 

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions