Skip to content

Typescript enums break after upgrade from 9.3.6 to 9.4.0 #12786

Closed
@majelbstoat

Description

@majelbstoat

Bug report

Upgrading to Next 9.4 breaks Typescript enum definitions.

Describe the bug

With Next 9.3.6, the following file can be included in a project with no issues:

export enum SearchEntity {
  SEARCH_ENTITY_NONE = 0,
  SEARCH_ENTITY_POSITION = 1,
  SEARCH_ENTITY_USER = 2,
  SEARCH_ENTITY_QUESTION = 3,
  SEARCH_ENTITY_TOPIC = 4,
}

With 9.4.0, the following error occurs:

error - ./lib/search/search_gw.ts 1:7
Module parse failed: Unexpected token (1:7)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> export enum SearchEntity {
|   SEARCH_ENTITY_NONE = 0,
|   SEARCH_ENTITY_POSITION = 1,

I don't have any custom babel config, and I use the standard out of the box Typescript support.

I've confirmed that removing the enum from the file lets the rest of the file be compiled.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. import a file that includes export enum

Expected behavior

The code should compile, as it did with 9.3.6.

System information

  • OS: [macOS]
  • Version of Next.js: [9.4.0]
  • Version of Typescript: [3.8.3]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions