Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'export interface' of typescript not compiling correctly #10570

regalskr2006 opened this issue Oct 17, 2019 · 2 comments


Copy link

@regalskr2006 regalskr2006 commented Oct 17, 2019

Bug Report

Current Behavior
Throw an error

ERROR in ./app/validator/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: D:\Projects\Sample\sample-admin\app\validator\index.js: Unexpected token (19:17)

  17 | };
  18 | 
> 19 | export interface Lengths{
     |        ^
  20 |   maxLength?: number;
  21 |   minLength?: number;

at Object.raise (J:\Projects\Poitore\poitore-admin\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:3851:17)
    at Object.unexpected (D:\Projects\Sample\sample-admin\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:5167:16)
    at Object.parseExportFrom (JD:\Projects\Sample\sample-admin\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:8499:14)
    at Object.parseExport (D:\Projects\Sample\sample-admin\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:8354:12)
    at Object.parseStatementContent (D:\Projects\Sample\sample-admin\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:7395:27)
    at Object.parseStatement (D:\Projects\Sample\sample-admin\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:7291:17)
    at Object.parseBlockOrModuleBlockBody (D:\Projects\Sample\sample-admin\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:7868:25)
    at Object.parseBlockBody (J:\Projects\Poitore\poitore-admin\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:7855:10)
    at Object.parseTopLevel (D:\Projects\Sample\sample-admin\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:7220:10)
    at Object.parse (D:\Projects\Sample\sample-admin\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:8863:17)

Input Code

export interface Lengths {
  maxLength?: number;
  minLength?: number;

Expected behavior/code
Compiled correctly

Babel Configuration (.babelrc, package.json, cli command)

presets: [
        modules: false,
  plugins: [
  env: {
    production: {
      only: ['app'],
      plugins: [
    test: {
      plugins: [


software version(s)
Babel 7.4.3
node 8.12.0
npm  6.12.0
Operating System windows 7

This comment has been minimized.

Copy link

@babel-bot babel-bot commented Oct 17, 2019

Hey @regalskr2006! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite."


This comment has been minimized.

Copy link

@JLHwung JLHwung commented Oct 17, 2019

There are multiple issues on your example.

  1. If you would like to parse TypeScript with babel, please add @babel/preset-typescript to the presets field in your configuration

  2. The error is thrown from \app\validator\index.js. A .js file should not use TypeScript syntax, consider change it to .ts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.