Skip to content

ESLint: Parsing errors while using some typescript features #9

@michael-braun

Description

@michael-braun

Some typescript language features seems to throw parsing errors while using the default ESLint-Config from chayns-toolkit and the chayns-toolkit lint command. It only happens, when you import a typescript file within a javascript-file (including jsx).

The features that throw a parsing exceptions are:

  • Type Assertions using the as operator
  • The keyof operator

Steps to reproduce:

  1. create a new project using create-chayns-app
  2. install typescript (4.0.5 is the last version that is currently officially supported by @typescript-eslint/typescript-estree)
  3. start the created app to generate a tsconfig.json file
  4. create a new file src/test.ts with the content export cosnt test = {} as { test?: string }
  5. import the test-constant inside the src/index.jsx file and use it (e.g. use console.log(test))

Example:
The linting of the line type DialogOptionsKey = keyof DialogOptions is aborted with Parse errors in imported module ../../utils/getDialogOption.ts: Line 6: Unexpected token, expected ";"

Versions:

  • typescript: 4.0.5
  • chayns-toolkit: 1.5.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions