Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Parsing error when using union types #403

Closed
ibufu opened this issue Oct 31, 2017 · 1 comment
Closed

Parsing error when using union types #403

ibufu opened this issue Oct 31, 2017 · 1 comment
Labels

Comments

@ibufu
Copy link

ibufu commented Oct 31, 2017

What version of TypeScript are you using?
v2.5.3

What version of typescript-eslint-parser are you using?
latest

What code were you trying to parse?

data() {
    return {
      form: {
        startDate: <Date | undefined> undefined
      }
    };
}

What did you expect to happen?

What happened?

parsing error.

@JamesHenry
Copy link
Member

@ibufu do you have jsx: true in your parserOptions? That is the only way I can reproduce this.

Please see #399 for more information about this. Essentially when jsx: true, you cannot use ambiguous TS constructs such as the <> syntax for type assertions. You could refactor your code to use the as syntax instead.

I will close this out for now, but please let me know if my assumption about you using jsx is not accurate.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants