-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fix) Keep parantheses in script tags for which JS is assumed (#224)
If a script tag is assumed to be JS, use babel-ts now to format the contents. The formatter prints a little different, keeping parantheses in more places, which fixes #218 . The change is not perfect because it would be better to know for sure that the language is JS, which we cannot know because of the possible language defaults.
- Loading branch information
1 parent
69fc702
commit 9d1486e
Showing
6 changed files
with
80 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<script> | ||
const x = /** @type {Foo} */ (a.b).c(); | ||
const y = /** @type {Foo} */ a.b.c(); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<script> | ||
interface A { | ||
b: string; | ||
} | ||
type Foo<T> = T extends true ? A & { b: boolean } : string; | ||
type SeussFish = `${Quantity | Color} fish`; | ||
const a: A = { b: "" }; | ||
|
||
function foo(a: A): void { | ||
const foo = <Foo<true>>a; | ||
return null as any; | ||
} | ||
|
||
const bar: () => void = () => {}; | ||
|
||
abstract class B<T> { | ||
t: T; | ||
} | ||
|
||
enum E { | ||
a = 1, | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<script lang="ts"> | ||
interface A { | ||
b: string; | ||
} | ||
type Foo<T> = T extends true ? A & { b: boolean } : string; | ||
type SeussFish = `${Quantity | Color} fish`; | ||
const a: A = { b: "" }; | ||
|
||
function foo(a: A): void { | ||
const foo = <Foo<true>>a; | ||
return null as any; | ||
} | ||
|
||
const bar: () => void = () => {}; | ||
|
||
abstract class B<T> { | ||
t: T; | ||
} | ||
|
||
enum E { | ||
a = 1, | ||
} | ||
</script> |