Skip to content

Commit

Permalink
Support type only import/export via babel-ts (#7804)
Browse files Browse the repository at this point in the history
  • Loading branch information
sosukesuzuki committed Mar 21, 2020
1 parent 71b2d35 commit 20c7a5a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions changelog_unreleased/typescript/pr-7631.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#### TypeScript 3.8 ([#7631](https://github.com/prettier/prettier/pull/7631) by [@thorn0](https://github.com/thorn0), [#7764](https://github.com/prettier/prettier/pull/7764) by [@sosukesuzuki](https://github.com/sosukesuzuki))
#### TypeScript 3.8 ([#7631](https://github.com/prettier/prettier/pull/7631) by [@thorn0](https://github.com/thorn0), [#7764](https://github.com/prettier/prettier/pull/7764) by [@sosukesuzuki](https://github.com/sosukesuzuki), [#7804](https://github.com/prettier/prettier/pull/7804) by [@sosukesuzuki](https://github.com/sosukesuzuki))

Prettier now supports the new syntax added in TypeScript 3.8:

- [Type-Only Imports and Exports](https://devblogs.microsoft.com/typescript/announcing-typescript-3-8/#type-only-imports-exports) (not supported by the `babel-ts` parser yet)
- [Type-Only Imports and Exports](https://devblogs.microsoft.com/typescript/announcing-typescript-3-8/#type-only-imports-exports)
- [ECMAScript Private Fields](https://devblogs.microsoft.com/typescript/announcing-typescript-3-8/#ecmascript-private-fields)
- [`export * as ns`](https://devblogs.microsoft.com/typescript/announcing-typescript-3-8/#export-star-as-namespace-syntax)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"@angular/compiler": "9.0.5",
"@babel/code-frame": "7.8.0",
"@babel/parser": "7.8.8",
"@babel/parser": "7.9.2",
"@glimmer/syntax": "0.48.0",
"@iarna/toml": "2.2.3",
"@typescript-eslint/typescript-estree": "2.24.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export type { SomeThing };
export type { A as B };
export type { B as C } from './a';
export type { foo } from 'bar';
export type * from 'bar';
export type { foo };
// this should be treated as a normal import statement
Expand All @@ -28,7 +27,6 @@ export type { SomeThing };
export type { A as B };
export type { B as C } from "./a";
export type { foo } from "bar";
export type * from "bar";
export type { foo };
// this should be treated as a normal import statement
Expand Down
3 changes: 1 addition & 2 deletions tests/typescript_import_export/jsfmt.spec.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
// TODO: remove disableBabelTS when Babel's TS plugin gets support for import/export `type` modifier
run_spec(__dirname, ["typescript"], { disableBabelTS: true });
run_spec(__dirname, ["typescript"]);
1 change: 0 additions & 1 deletion tests/typescript_import_export/type-modifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export type { SomeThing };
export type { A as B };
export type { B as C } from './a';
export type { foo } from 'bar';
export type * from 'bar';
export type { foo };

// this should be treated as a normal import statement
Expand Down
7 changes: 6 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,12 @@
esutils "^2.0.2"
js-tokens "^4.0.0"

"@babel/parser@7.8.8", "@babel/parser@^7.1.0", "@babel/parser@^7.7.5", "@babel/parser@^7.8.6", "@babel/parser@^7.8.7":
"@babel/parser@7.9.2":
version "7.9.2"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.9.2.tgz#4e767f424b479c514077544484d1f9bdba7f1158"
integrity sha512-2jyvKdoOS1aWAFL2rjJZmamyDDkPCx/AAz4/Wh1Dfxvw8qqnOvek/ZlHQ2noO/o8JpnXa/WiUUFOv48meBKkpA==

"@babel/parser@^7.1.0", "@babel/parser@^7.7.5", "@babel/parser@^7.8.6", "@babel/parser@^7.8.7":
version "7.8.8"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.8.8.tgz#4c3b7ce36db37e0629be1f0d50a571d2f86f6cd4"
integrity sha512-mO5GWzBPsPf6865iIbzNE0AvkKF3NE+2S3eRUpE+FE07BOAkXh6G+GW/Pj01hhXjve1WScbaIO4UlY1JKeqCcA==
Expand Down

0 comments on commit 20c7a5a

Please sign in to comment.