feat(typescript): support TS 3.4 (#6027)
- add support for `readonly` operator - `as const` was already supported, added tests to ensure no regressionmaster
parent
0b07e10833
commit
f4bcb13d41
|
@ -238,3 +238,17 @@ Examples:
|
|||
// Output (Prettier master)
|
||||
<div *ngIf="isRendered | async"></div>
|
||||
```
|
||||
|
||||
- TypeScript: Support `readonly` operator ([#6027] by [@ikatyang])
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```ts
|
||||
// Input
|
||||
declare const array: readonly number[];
|
||||
|
||||
// Output (Prettier stable)
|
||||
// SyntaxError: ',' expected.
|
||||
|
||||
// Output (Prettier master)
|
||||
declare const array: readonly number[];
|
||||
```
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"@babel/parser": "7.2.0",
|
||||
"@glimmer/syntax": "0.30.3",
|
||||
"@iarna/toml": "2.0.0",
|
||||
"@typescript-eslint/typescript-estree": "1.1.0",
|
||||
"@typescript-eslint/typescript-estree": "1.6.0",
|
||||
"angular-estree-parser": "1.1.5",
|
||||
"angular-html-parser": "1.2.0",
|
||||
"camelcase": "4.1.0",
|
||||
|
@ -67,7 +67,7 @@
|
|||
"resolve": "1.5.0",
|
||||
"semver": "5.4.1",
|
||||
"string-width": "3.0.0",
|
||||
"typescript": "3.2.2",
|
||||
"typescript": "3.4.1",
|
||||
"unicode-regex": "2.0.0",
|
||||
"unified": "6.1.6",
|
||||
"vnopts": "1.0.2",
|
||||
|
|
|
@ -1,5 +1,19 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`as-const.ts 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
let x = '123' as const;
|
||||
|
||||
=====================================output=====================================
|
||||
let x = "123" as const;
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`generic-cast.ts 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
let x = '123' as const;
|
|
@ -1,5 +1,21 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`array.ts 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
declare const array: readonly number[];
|
||||
declare const tuple: readonly [number, number];
|
||||
|
||||
=====================================output=====================================
|
||||
declare const array: readonly number[];
|
||||
declare const tuple: readonly [number, number];
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`readonly.ts 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
declare const array: readonly number[];
|
||||
declare const tuple: readonly [number, number];
|
16
yarn.lock
16
yarn.lock
|
@ -674,10 +674,10 @@
|
|||
version "5.5.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45"
|
||||
|
||||
"@typescript-eslint/typescript-estree@1.1.0":
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.1.0.tgz#31f19e7197814cb3e609f2822ad6003b6e326470"
|
||||
integrity sha512-eABnKqJVv0Mm5uYon8Xw61SXldvOhWKDQdoZqsJ/YqEa9XvWV1URXdRvTOW8GLsKo4X3Un7pHKqKZhfbbUEGww==
|
||||
"@typescript-eslint/typescript-estree@1.6.0":
|
||||
version "1.6.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.6.0.tgz#6cf43a07fee08b8eb52e4513b428c8cdc9751ef0"
|
||||
integrity sha512-A4CanUwfaG4oXobD5y7EXbsOHjCwn8tj1RDd820etpPAjH+Icjc2K9e/DQM1Hac5zH2BSy+u6bjvvF2wwREvYA==
|
||||
dependencies:
|
||||
lodash.unescape "4.0.1"
|
||||
semver "5.5.0"
|
||||
|
@ -5784,10 +5784,10 @@ typedarray@^0.0.6:
|
|||
version "0.0.6"
|
||||
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
||||
|
||||
typescript@3.2.2:
|
||||
version "3.2.2"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.2.tgz#fe8101c46aa123f8353523ebdcf5730c2ae493e5"
|
||||
integrity sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg==
|
||||
typescript@3.4.1:
|
||||
version "3.4.1"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.1.tgz#b6691be11a881ffa9a05765a205cb7383f3b63c6"
|
||||
integrity sha512-3NSMb2VzDQm8oBTLH6Nj55VVtUEpe/rgkIzMir0qVoLyjDZlnMBva0U6vDiV3IH+sl/Yu6oP5QwsAQtHPmDd2Q==
|
||||
|
||||
ua-parser-js@^0.7.9:
|
||||
version "0.7.17"
|
||||
|
|
Loading…
Reference in New Issue