JSX namespaced attribute syntax not supported
See original GitHub issueTypeScript Version:
1.8.2
Background:
I have been working on trying to get https://github.com/eslint/typescript-eslint-parser, a TypeScript parser plugin for ESLint, off the ground, and the job this weekend has been to begin adding JSX support.
ESLint uses espree and so the aim of the project is to convert the output of the tsc to an AST which espree expects. We already have a solid suite of JSX tests to develop against (taken from the espree project itself), but I have come up against a tsc error in one of them so far.
My issue is that it seems currently the tsc does not accept this “namespaced attribute” JSX syntax:
Code
<a n:foo="bar"> {value} <b><c /></b></a>;
Expected behavior:
Please note the AST produced by espree (see in particular the tokens
array): http://astexplorer.net/#/B46lew7I59
Actual behavior:
…compared to the one produced by the tsc (note the issues found in parseDiagnostics
):
http://astexplorer.net/#/G5L3CptVNq
Removing the n:
from n:foo
resolves the parsing issues.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:14 (6 by maintainers)
Top GitHub Comments
@RyanCavanaugh Vue JSX uses namespace for directive arguments, any chance TypeScript could support it? https://github.com/vuejs/jsx#directives
I also hope a universal solution to embed different template, such as like markdown.