Typescript

npm install --save-dev @babel/core @babel/node @babel/register @babel/preset-typescript

Add @babel/preset-typescript to your .babelrc file.

{
    "presets": [
        [
            "@babel/preset-typescript",
            {
                "allExtensions": true,
                "isTSX": true
            }
        ]
    ]
}

After you have this, run the command

npx mockit start --compiler @babel/register

If you received complaints about SyntaxError: Unexpected identifier, then try to add @babel/preset-env to your presets list after installing it.

npm install --save-dev @babel/preset-env

{
    "presets": [
        "@babel/preset-env",
        [
            "@babel/preset-typescript",
            {
                "allExtensions": true,
                "isTSX": true
            }
        ]
    ]
}

Last updated