You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/catalog/tsx/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ This page curates a list of example ast-grep rules to check and to rewrite TypeS
6
6
TypeScript is a typed JavaScript extension and TSX is a further extension that allows JSX elements.
7
7
They need different parsers because of [conflicting syntax](https://www.typescriptlang.org/docs/handbook/jsx.html#the-as-operator).
8
8
9
-
TS allows both the `as` operator and angle brackets (`<>`) for type assertions. While TSX only allows the `as` operator because it interprets angle brackets as JSX elements.
9
+
In order to reduce rule duplication, you can use the [`languageGlobs`](/reference/sgconfig.html#languageglobs) option to force ast-grep to use parse `.ts` files as TSX.
Copy file name to clipboardExpand all lines: website/catalog/typescript/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ Check out the [Repository of ESLint rules](https://github.com/ast-grep/eslint/)
7
7
TypeScript is a typed JavaScript extension and TSX is a further extension that allows JSX elements.
8
8
They need different parsers because of [conflicting syntax](https://www.typescriptlang.org/docs/handbook/jsx.html#the-as-operator).
9
9
10
-
TS allows both the `as` operator and angle brackets (`<>`) for type assertions. While TSX only allows the `as` operator because it interprets angle brackets as JSX elements.
10
+
However, you can use the [`languageGlobs`](/reference/sgconfig.html#languageglobs) option to force ast-grep to use parse `.ts` files as TSX.
0 commit comments