This commit is contained in:
James Ives 2020-05-24 10:59:46 -04:00
parent 04ed3b0144
commit b1015a679d
33 changed files with 472 additions and 205 deletions

View File

@ -151,6 +151,7 @@ function deploy(action) {
}
finally {
// Ensures the deployment directory is safely removed after each deployment.
yield execute_1.execute(`git worktree remove ${temporaryDeploymentDirectory}`, action.workspace);
yield io_1.rmRF(temporaryDeploymentDirectory);
}
});

2
node_modules/@types/jest/README.md generated vendored
View File

@ -8,7 +8,7 @@ This package contains type definitions for Jest (https://jestjs.io/).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest.
### Additional Details
* Last updated: Wed, 13 May 2020 18:46:57 GMT
* Last updated: Mon, 18 May 2020 19:24:51 GMT
* Dependencies: none
* Global values: `afterAll`, `afterEach`, `beforeAll`, `beforeEach`, `describe`, `expect`, `fail`, `fdescribe`, `fit`, `it`, `jasmine`, `jest`, `pending`, `spyOn`, `test`, `xdescribe`, `xit`, `xtest`

View File

@ -1,6 +1,6 @@
{
"name": "@types/jest",
"version": "25.2.2",
"version": "25.2.3",
"description": "TypeScript definitions for Jest",
"license": "MIT",
"contributors": [
@ -142,6 +142,13 @@
],
"main": "",
"types": "index.d.ts",
"typesVersions": {
">=3.2.0-0": {
"*": [
"ts3.2/*"
]
}
},
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
@ -152,6 +159,6 @@
"jest-diff": "^25.2.1",
"pretty-format": "^25.2.1"
},
"typesPublisherContentHash": "bf41c289d7d9b270f34a947c0d9270d6b4f883aa09e9dcdbc5f95911376b43eb",
"typesPublisherContentHash": "c17443c55a78b43f5c843e670e87df208c8c341a3354df4f1a233c880653eaf0",
"typeScriptVersion": "3.1"
}

23
node_modules/@types/jest/ts3.2/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,23 @@
// tslint:disable-next-line:no-bad-reference
/// <reference path="../index.d.ts" />
declare namespace jest {
interface Matchers<R, T = {}> {
/**
* For comparing numbers or big integer values.
*/
toBeGreaterThan(expected: number | bigint): R;
/**
* For comparing numbers or big integer values.
*/
toBeGreaterThanOrEqual(expected: number | bigint): R;
/**
* For comparing numbers or big integer values.
*/
toBeLessThan(expected: number | bigint): R;
/**
* For comparing numbers or big integer values.
*/
toBeLessThanOrEqual(expected: number | bigint): R;
}
}

4
node_modules/@types/node/README.md generated vendored
View File

@ -8,9 +8,9 @@ This package contains type definitions for Node.js (http://nodejs.org/).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
### Additional Details
* Last updated: Wed, 13 May 2020 00:31:42 GMT
* Last updated: Thu, 21 May 2020 20:08:41 GMT
* Dependencies: none
* Global values: `Buffer`, `Symbol`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
# Credits
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alexander T.](https://github.com/a-tarasyuk), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Bruno Scheufler](https://github.com/brunoscheufler), [Chigozirim C.](https://github.com/smac89), [Christian Vaagland Tellnes](https://github.com/tellnes), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Flarna](https://github.com/Flarna), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Hoàng Văn Khải](https://github.com/KSXGitHub), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nicolas Voigt](https://github.com/octo-sniffle), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Jordi Oliveras Rovira](https://github.com/j-oliveras), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Minh Son Nguyen](https://github.com/nguymin4), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Surasak Chaisurin](https://github.com/Ryan-Willpower), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alexander T.](https://github.com/a-tarasyuk), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Bruno Scheufler](https://github.com/brunoscheufler), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Flarna](https://github.com/Flarna), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Hoàng Văn Khải](https://github.com/KSXGitHub), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nicolas Voigt](https://github.com/octo-sniffle), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Jordi Oliveras Rovira](https://github.com/j-oliveras), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Minh Son Nguyen](https://github.com/nguymin4), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Surasak Chaisurin](https://github.com/Ryan-Willpower), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), and [Jason Kwok](https://github.com/JasonHK).

10
node_modules/@types/node/events.d.ts generated vendored
View File

@ -43,6 +43,16 @@ declare module "events" {
/** @deprecated since v4.0.0 */
static listenerCount(emitter: EventEmitter, event: string | symbol): number;
static defaultMaxListeners: number;
/**
* This symbol shall be used to install a listener for only monitoring `'error'`
* events. Listeners installed using this symbol are called before the regular
* `'error'` listeners are called.
*
* Installing a listener using this symbol does not change the behavior once an
* `'error'` event is emitted, therefore the process will still crash if no
* regular `'error'` listener is installed.
*/
static readonly errorMonitor: unique symbol;
}
}

View File

@ -141,7 +141,6 @@ interface RequireResolve extends NodeJS.RequireResolve {}
interface NodeModule extends NodeJS.Module {}
declare var process: NodeJS.Process;
declare var global: NodeJS.Global;
declare var console: Console;
declare var __filename: string;
@ -919,6 +918,7 @@ declare namespace NodeJS {
on(event: "newListener", listener: NewListenerListener): this;
on(event: "removeListener", listener: RemoveListenerListener): this;
on(event: "multipleResolves", listener: MultipleResolveListener): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "beforeExit", listener: BeforeExitListener): this;
once(event: "disconnect", listener: DisconnectListener): this;

1
node_modules/@types/node/globals.global.d.ts generated vendored Normal file
View File

@ -0,0 +1 @@
declare var global: NodeJS.Global;

View File

@ -9,7 +9,6 @@
// Benjamin Toueg <https://github.com/btoueg>
// Bruno Scheufler <https://github.com/brunoscheufler>
// Chigozirim C. <https://github.com/smac89>
// Christian Vaagland Tellnes <https://github.com/tellnes>
// David Junger <https://github.com/touffy>
// Deividas Bakanas <https://github.com/DeividasBakanas>
// Eugene Y. Q. Shen <https://github.com/eyqs>
@ -43,6 +42,8 @@
// ExE Boss <https://github.com/ExE-Boss>
// Surasak Chaisurin <https://github.com/Ryan-Willpower>
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Anna Henningsen <https://github.com/addaleax>
// Jason Kwok <https://github.com/JasonHK>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// NOTE: These definitions support NodeJS and TypeScript 3.5.
@ -59,7 +60,10 @@
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
/// <reference path="base.d.ts" />
// We can't include assert.d.ts in base.d.ts, as it'll cause duplication errors in +ts3.7
// We can't include globals.global.d.ts in globals.d.ts, as it'll cause duplication errors in TypeScript 3.5+
/// <reference path="globals.global.d.ts" />
// We can't include assert.d.ts in base.d.ts, as it'll cause duplication errors in TypeScript 3.7+
/// <reference path="assert.d.ts" />
// Forward-declarations for needed types from es2015 and later (in case users are using `--lib es5`)

View File

@ -1,6 +1,6 @@
{
"name": "@types/node",
"version": "14.0.1",
"version": "14.0.5",
"description": "TypeScript definitions for Node.js",
"license": "MIT",
"contributors": [
@ -49,11 +49,6 @@
"url": "https://github.com/smac89",
"githubUsername": "smac89"
},
{
"name": "Christian Vaagland Tellnes",
"url": "https://github.com/tellnes",
"githubUsername": "tellnes"
},
{
"name": "David Junger",
"url": "https://github.com/touffy",
@ -218,6 +213,16 @@
"name": "Piotr Błażejewicz",
"url": "https://github.com/peterblazejewicz",
"githubUsername": "peterblazejewicz"
},
{
"name": "Anna Henningsen",
"url": "https://github.com/addaleax",
"githubUsername": "addaleax"
},
{
"name": "Jason Kwok",
"url": "https://github.com/JasonHK",
"githubUsername": "JasonHK"
}
],
"main": "",
@ -246,6 +251,6 @@
},
"scripts": {},
"dependencies": {},
"typesPublisherContentHash": "8ea7ddbe20b5fd5322d81c14e4ea40015943081187d2a9627a21dc93e4d9a6f8",
"typeScriptVersion": "2.9"
"typesPublisherContentHash": "3c6dff84a51cbfcb7b5fafcfe136319afe7fe4df89f6246837084ae5c2e5f8b3",
"typeScriptVersion": "3.0"
}

View File

@ -4,7 +4,7 @@
// - ~/base.d.ts - Shared definitions common to all TypeScript versions
// - ~/index.d.ts - Definitions specific to TypeScript 2.1
// - ~/ts3.2/base.d.ts - Definitions specific to TypeScript 3.2
// - ~/ts3.2/index.d.ts - Definitions specific to TypeScript 3.2 with assert pulled in
// - ~/ts3.2/index.d.ts - Definitions specific to TypeScript 3.2 with global and assert pulled in
// Reference required types from the default lib:
/// <reference lib="es2018" />

View File

@ -1,4 +1,5 @@
// NOTE: These definitions support NodeJS and TypeScript 3.2.
// This is requried to enable globalThis support for global in ts3.5 without causing errors
// This is requried to enable typing assert in ts3.7 without causing errors
// Typically type modifiations should be made in base.d.ts instead of here
@ -6,3 +7,6 @@
// tslint:disable-next-line:no-bad-reference
/// <reference path="../assert.d.ts" />
// tslint:disable-next-line:no-bad-reference
/// <reference path="../globals.global.d.ts" />

View File

@ -16,5 +16,8 @@
// tslint:disable-next-line:no-bad-reference
/// <reference path="../ts3.2/base.d.ts" />
// TypeScript 3.5-specific augmentations:
/// <reference path="globals.global.d.ts" />
// TypeScript 3.5-specific augmentations:
/// <reference path="wasi.d.ts" />

1
node_modules/@types/node/ts3.5/globals.global.d.ts generated vendored Normal file
View File

@ -0,0 +1 @@
declare var global: NodeJS.Global & typeof globalThis;

1
node_modules/@types/node/util.d.ts generated vendored
View File

@ -123,6 +123,7 @@ declare module "util" {
function isAnyArrayBuffer(object: any): boolean;
function isArgumentsObject(object: any): object is IArguments;
function isArrayBuffer(object: any): object is ArrayBuffer;
function isArrayBufferView(object: any): object is ArrayBufferView;
function isAsyncFunction(object: any): boolean;
function isBooleanObject(object: any): object is Boolean;
function isBoxedPrimitive(object: any): object is (Number | Boolean | String | Symbol /* | Object(BigInt) | Object(Symbol) */);

View File

@ -1,3 +1,26 @@
## [23.13.1](https://github.com/jest-community/eslint-plugin-jest/compare/v23.13.0...v23.13.1) (2020-05-17)
### Bug Fixes
* **no-if:** use correct syntax for placeholder substitution in message ([6d1eda8](https://github.com/jest-community/eslint-plugin-jest/commit/6d1eda89ac48c93c2675dcf24a92574a20b2edb9))
# [23.13.0](https://github.com/jest-community/eslint-plugin-jest/compare/v23.12.0...v23.13.0) (2020-05-16)
### Features
* **valid-expect:** support `minArgs` & `maxArgs` options ([#584](https://github.com/jest-community/eslint-plugin-jest/issues/584)) ([9e0e2fa](https://github.com/jest-community/eslint-plugin-jest/commit/9e0e2fa966b43c1099d11b2424acb1590c241c03))
# [23.12.0](https://github.com/jest-community/eslint-plugin-jest/compare/v23.11.0...v23.12.0) (2020-05-16)
### Features
* deprecate `no-expect-resolves` rule ([b6a22e5](https://github.com/jest-community/eslint-plugin-jest/commit/b6a22e5aa98abcb57aac217c6d4583d0a3388e7b))
* deprecate `no-truthy-falsy` rule ([a67d92d](https://github.com/jest-community/eslint-plugin-jest/commit/a67d92d2834568122f24bf3d8455999166da95ea))
* deprecate `prefer-inline-snapshots` rule ([1360e9b](https://github.com/jest-community/eslint-plugin-jest/commit/1360e9b0e840f4f778a9d251371c943919f84600))
# [23.11.0](https://github.com/jest-community/eslint-plugin-jest/compare/v23.10.0...v23.11.0) (2020-05-12)

View File

@ -137,7 +137,6 @@ installations requiring long-term consistency.
| [no-deprecated-functions](docs/rules/no-deprecated-functions.md) | Disallow use of deprecated functions | | ![fixable][] |
| [no-disabled-tests](docs/rules/no-disabled-tests.md) | Disallow disabled tests | ![recommended][] | |
| [no-duplicate-hooks](docs/rules/no-duplicate-hooks.md) | Disallow duplicate setup and teardown hooks | | |
| [no-expect-resolves](docs/rules/no-expect-resolves.md) | Disallow expect.resolves | | |
| [no-export](docs/rules/no-export.md) | Prevent exporting from test files | ![recommended][] | |
| [no-focused-tests](docs/rules/no-focused-tests.md) | Disallow focused tests | ![recommended][] | ![fixable][] |
| [no-hooks](docs/rules/no-hooks.md) | Disallow setup and teardown hooks | | |
@ -152,12 +151,10 @@ installations requiring long-term consistency.
| [no-test-callback](docs/rules/no-test-callback.md) | Avoid using a callback in asynchronous tests | ![recommended][] | ![fixable][] |
| [no-test-prefixes](docs/rules/no-test-prefixes.md) | Use `.only` and `.skip` over `f` and `x` | ![recommended][] | ![fixable][] |
| [no-test-return-statement](docs/rules/no-test-return-statement.md) | Disallow explicitly returning from tests | | |
| [no-truthy-falsy](docs/rules/no-truthy-falsy.md) | Disallow using `toBeTruthy()` & `toBeFalsy()` | | |
| [no-try-expect](docs/rules/no-try-expect.md) | Prefer using toThrow for exception tests | ![recommended][] | |
| [prefer-called-with](docs/rules/prefer-called-with.md) | Suggest using `toBeCalledWith()` OR `toHaveBeenCalledWith()` | | |
| [prefer-expect-assertions](docs/rules/prefer-expect-assertions.md) | Suggest using `expect.assertions()` OR `expect.hasAssertions()` | | |
| [prefer-hooks-on-top](docs/rules/prefer-hooks-on-top.md) | Suggest to have all hooks at top level | | |
| [prefer-inline-snapshots](docs/rules/prefer-inline-snapshots.md) | Suggest using inline snapshots | | ![fixable][] |
| [prefer-spy-on](docs/rules/prefer-spy-on.md) | Suggest using `jest.spyOn()` | | ![fixable][] |
| [prefer-strict-equal](docs/rules/prefer-strict-equal.md) | Suggest using toStrictEqual() | | ![fixable][] |
| [prefer-to-be-null](docs/rules/prefer-to-be-null.md) | Suggest using `toBeNull()` | ![style][] | ![fixable][] |

View File

@ -1,4 +1,4 @@
# Disallow use of deprecated functions (no-deprecated-functions)
# Disallow use of deprecated functions (`no-deprecated-functions`)
Over the years Jest has accrued some debt in the form of functions that have
either been renamed for clarity, or replaced with more powerful APIs.

View File

@ -1,5 +1,23 @@
# Avoid using `expect().resolves` (`no-expect-resolves`)
## Deprecated
This rule has been deprecated in favor of
[`no-restricted-matchers`](no-restricted-matchers.md) with the following config:
```json
{
"rules": {
"jest/no-restricted-matchers": [
"error",
{ "resolves": "Use `expect(await promise)` instead." }
]
}
}
```
---
Jest allows you to test a promise resolve value using `await expect().resolves`.
For consistency and readability this rule bans `expect().resolves` in favor of
`expect(await promise)`.

View File

@ -1,5 +1,26 @@
# Disallow using `toBeTruthy()` & `toBeFalsy()` (`no-truthy-falsy`)
## Deprecated
This rule has been deprecated in favor of
[`no-restricted-matchers`](no-restricted-matchers.md) with the following config:
```json
{
"rules": {
"jest/no-restricted-matchers": [
"error",
{
"toBeTruthy": "Avoid `toBeTruthy`",
"toBeFalsy": "Avoid `toBeFalsy`"
}
]
}
}
```
---
Tests against boolean values should assert true or false. Asserting `toBeTruthy`
or `toBeFalsy` matches non-boolean values as well and encourages weaker tests.

View File

@ -1,5 +1,26 @@
# Suggest using inline snapshots (`prefer-inline-snapshots`)
## Deprecated
This rule has been deprecated in favor of
[`no-restricted-matchers`](no-restricted-matchers.md) with the following config:
```json
{
"rules": {
"jest/no-restricted-matchers": [
"error",
{
"toThrowErrorMatchingSnapshot": "Use `toThrowErrorMatchingInlineSnapshot()` instead",
"toMatchSnapshot": "Use `toMatchInlineSnapshot()` instead"
}
]
}
}
```
---
In order to make snapshot tests more managable and reviewable
`toMatchInlineSnapshot()` and `toThrowErrorMatchingInlineSnapshot` should be
used to write the snapshots inline in the test file.

View File

@ -30,7 +30,7 @@ This rule is enabled by default.
## Options
```js
```json5
{
type: 'object',
properties: {
@ -38,6 +38,14 @@ This rule is enabled by default.
type: 'boolean',
default: false,
},
minArgs: {
type: 'number',
minimum: 1,
},
maxArgs: {
type: 'number',
minimum: 1,
},
},
additionalProperties: false,
}
@ -70,6 +78,18 @@ test('test1', async () => {
test('test2', () => expect(Promise.resolve(2)).resolves.toBe(2));
```
### `minArgs` & `maxArgs`
Enforces the minimum and maximum number of arguments that `expect` can take, and
is required to take.
Both of these properties have a default value of `1`, which is the number of
arguments supported by vanilla `expect`.
This is useful when you're using libraries that increase the number of arguments
supported by `expect`, such as
[`jest-expect-message`](https://www.npmjs.com/package/jest-expect-message).
### Default configuration
The following patterns are considered warnings:

View File

@ -15,6 +15,8 @@ var _default = (0, _utils.createRule)({
description: 'Disallow expect.resolves',
recommended: false
},
deprecated: true,
replacedBy: ['no-restricted-matchers'],
messages: {
expectResolves: 'Use `expect(await promise)` instead.'
},

View File

@ -28,7 +28,7 @@ var _default = (0, _utils.createRule)({
recommended: false
},
messages: {
noConditionalExpect: 'Test should not contain { condition } statements.'
conditionalInTest: 'Test should not contain {{ condition }} statements.'
},
schema: [],
type: 'suggestion'
@ -49,7 +49,7 @@ var _default = (0, _utils.createRule)({
data: {
condition: conditionName[node.type]
},
messageId: 'noConditionalExpect',
messageId: 'conditionalInTest',
node
});
}

View File

@ -16,6 +16,8 @@ var _default = (0, _utils.createRule)({
description: 'Disallow using `toBeTruthy()` & `toBeFalsy()`',
recommended: false
},
deprecated: true,
replacedBy: ['no-restricted-matchers'],
messages: {
avoidMatcher: 'Avoid {{ matcherName }}'
},

View File

@ -17,6 +17,8 @@ var _default = (0, _utils.createRule)({
description: 'Suggest using inline snapshots',
recommended: false
},
deprecated: true,
replacedBy: ['no-restricted-matchers'],
messages: {
toMatch: 'Use toMatchInlineSnapshot() instead',
toMatchError: 'Use toThrowErrorMatchingInlineSnapshot() instead'

View File

@ -64,7 +64,8 @@ var _default = (0, _utils.createRule)({
recommended: 'error'
},
messages: {
incorrectNumberOfArguments: 'Expect takes one and only one argument.',
tooManyArgs: 'Expect takes at most {{ amount }} argument{{ s }}.',
notEnoughArgs: 'Expect requires at least {{ amount }} argument{{ s }}.',
modifierUnknown: 'Expect has no modifier named "{{ modifierName }}".',
matcherNotFound: 'Expect must have a corresponding matcher call.',
matcherNotCalled: 'Matchers must be called to assert.',
@ -78,17 +79,29 @@ var _default = (0, _utils.createRule)({
alwaysAwait: {
type: 'boolean',
default: false
},
minArgs: {
type: 'number',
minimum: 1
},
maxArgs: {
type: 'number',
minimum: 1
}
},
additionalProperties: false
}]
},
defaultOptions: [{
alwaysAwait: false
alwaysAwait: false,
minArgs: 1,
maxArgs: 1
}],
create(context, [{
alwaysAwait
alwaysAwait,
minArgs = 1,
maxArgs = 1
}]) {
// Context state
const arrayExceptions = new Set();
@ -117,9 +130,9 @@ var _default = (0, _utils.createRule)({
matcher
} = (0, _utils.parseExpectCall)(node);
if (expect.arguments.length !== 1) {
if (expect.arguments.length < minArgs) {
const expectLength = (0, _utils.getAccessorValue)(expect.callee).length;
let loc = {
const loc = {
start: {
column: node.loc.start.column + expectLength,
line: node.loc.start.line
@ -129,25 +142,37 @@ var _default = (0, _utils.createRule)({
line: node.loc.start.line
}
};
if (expect.arguments.length !== 0) {
const {
start
} = expect.arguments[1].loc;
const {
end
} = expect.arguments[node.arguments.length - 1].loc;
loc = {
start,
end: {
column: end.column - 1,
line: end.line
}
};
}
context.report({
messageId: 'incorrectNumberOfArguments',
messageId: 'notEnoughArgs',
data: {
amount: minArgs,
s: minArgs === 1 ? '' : 's'
},
node,
loc
});
}
if (expect.arguments.length > maxArgs) {
const {
start
} = expect.arguments[maxArgs].loc;
const {
end
} = expect.arguments[node.arguments.length - 1].loc;
const loc = {
start,
end: {
column: end.column - 1,
line: end.line
}
};
context.report({
messageId: 'tooManyArgs',
data: {
amount: maxArgs,
s: maxArgs === 1 ? '' : 's'
},
node,
loc
});

30
node_modules/typescript/lib/tsc.js generated vendored
View File

@ -67,7 +67,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
var ts;
(function (ts) {
ts.versionMajorMinor = "3.9";
ts.version = "3.9.2";
ts.version = "3.9.3";
function tryGetNativeMap() {
return typeof Map !== "undefined" && "entries" in Map.prototype ? Map : undefined;
}
@ -36320,7 +36320,7 @@ var ts;
return type.resolvedProperties;
}
function getPropertiesOfType(type) {
type = getApparentType(getReducedType(type));
type = getReducedApparentType(type);
return type.flags & 3145728 ?
getPropertiesOfUnionOrIntersectionType(type) :
getPropertiesOfObjectType(type);
@ -36600,6 +36600,9 @@ var ts;
t.flags & 2 && !strictNullChecks ? emptyObjectType :
t;
}
function getReducedApparentType(type) {
return getReducedType(getApparentType(getReducedType(type)));
}
function createUnionOrIntersectionProperty(containingType, name) {
var singleProp;
var propSet;
@ -36782,7 +36785,7 @@ var ts;
return errorInfo;
}
function getPropertyOfType(type, name) {
type = getApparentType(getReducedType(type));
type = getReducedApparentType(type);
if (type.flags & 524288) {
var resolved = resolveStructuredTypeMembers(type);
var symbol = resolved.members.get(name);
@ -36814,7 +36817,7 @@ var ts;
return ts.emptyArray;
}
function getSignaturesOfType(type, kind) {
return getSignaturesOfStructuredType(getApparentType(getReducedType(type)), kind);
return getSignaturesOfStructuredType(getReducedApparentType(type), kind);
}
function getIndexInfoOfStructuredType(type, kind) {
if (type.flags & 3670016) {
@ -36827,10 +36830,10 @@ var ts;
return info && info.type;
}
function getIndexInfoOfType(type, kind) {
return getIndexInfoOfStructuredType(getApparentType(getReducedType(type)), kind);
return getIndexInfoOfStructuredType(getReducedApparentType(type), kind);
}
function getIndexTypeOfType(type, kind) {
return getIndexTypeOfStructuredType(getApparentType(getReducedType(type)), kind);
return getIndexTypeOfStructuredType(getReducedApparentType(type), kind);
}
function getImplicitIndexTypeOfType(type, kind) {
if (isObjectTypeWithInferableIndex(type)) {
@ -38781,7 +38784,7 @@ var ts;
}
return type;
}
var apparentObjectType = getApparentType(getReducedType(objectType));
var apparentObjectType = getReducedApparentType(objectType);
if (indexType.flags & 1048576 && !(indexType.flags & 16)) {
var propTypes = [];
var wasMissingProp = false;
@ -47127,7 +47130,7 @@ var ts;
var right = _a[_i];
var left = props.get(right.escapedName);
var rightType = getTypeOfSymbol(right);
if (left && !maybeTypeOfKind(rightType, 98304) && !(maybeTypeOfKind(rightType, 1) && right.flags & 16777216)) {
if (left && !maybeTypeOfKind(rightType, 98304) && !(maybeTypeOfKind(rightType, 3) && right.flags & 16777216)) {
var diagnostic = error(left.valueDeclaration, ts.Diagnostics._0_is_specified_more_than_once_so_this_usage_will_be_overwritten, ts.unescapeLeadingUnderscores(left.escapedName));
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(spread, ts.Diagnostics.This_spread_always_overwrites_this_property));
}
@ -65183,9 +65186,12 @@ var ts;
return template.templateFlags ? ts.createIdentifier("undefined") : ts.createLiteral(template.text);
}
function getRawLiteral(node, currentSourceFile) {
var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
var isLast = node.kind === 14 || node.kind === 17;
text = text.substring(1, text.length - (isLast ? 1 : 2));
var text = node.rawText;
if (text === undefined) {
text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
var isLast = node.kind === 14 || node.kind === 17;
text = text.substring(1, text.length - (isLast ? 1 : 2));
}
text = text.replace(/\r\n?/g, "\n");
return ts.setTextRange(ts.createLiteral(text), node);
}
@ -74060,7 +74066,7 @@ var ts;
scoped: false,
dependencies: [ts.createBindingHelper],
priority: 2,
text: "\n var __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);\n }"
text: "\n var __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);\n };"
};
function createExportStarHelper(context, module) {
context.requestEmitHelper(exportStarHelper);

View File

@ -94,7 +94,7 @@ var ts;
// If changing the text in this section, be sure to test `configurePrerelease` too.
ts.versionMajorMinor = "3.9";
/** The version of the TypeScript compiler release */
ts.version = "3.9.2";
ts.version = "3.9.3";
/**
* Returns the native Map implementation if it is available and compatible (i.e. supports iteration).
*/
@ -43890,7 +43890,7 @@ var ts;
return type.resolvedProperties;
}
function getPropertiesOfType(type) {
type = getApparentType(getReducedType(type));
type = getReducedApparentType(type);
return type.flags & 3145728 /* UnionOrIntersection */ ?
getPropertiesOfUnionOrIntersectionType(type) :
getPropertiesOfObjectType(type);
@ -44223,6 +44223,13 @@ var ts;
t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType :
t;
}
function getReducedApparentType(type) {
// Since getApparentType may return a non-reduced union or intersection type, we need to perform
// type reduction both before and after obtaining the apparent type. For example, given a type parameter
// 'T extends A | B', the type 'T & X' becomes 'A & X | B & X' after obtaining the apparent type, and
// that type may need futher reduction to remove empty intersections.
return getReducedType(getApparentType(getReducedType(type)));
}
function createUnionOrIntersectionProperty(containingType, name) {
var singleProp;
var propSet;
@ -44433,7 +44440,7 @@ var ts;
* @param name a name of property to look up in a given type
*/
function getPropertyOfType(type, name) {
type = getApparentType(getReducedType(type));
type = getReducedApparentType(type);
if (type.flags & 524288 /* Object */) {
var resolved = resolveStructuredTypeMembers(type);
var symbol = resolved.members.get(name);
@ -44469,7 +44476,7 @@ var ts;
* maps primitive types and type parameters are to their apparent types.
*/
function getSignaturesOfType(type, kind) {
return getSignaturesOfStructuredType(getApparentType(getReducedType(type)), kind);
return getSignaturesOfStructuredType(getReducedApparentType(type), kind);
}
function getIndexInfoOfStructuredType(type, kind) {
if (type.flags & 3670016 /* StructuredType */) {
@ -44484,12 +44491,12 @@ var ts;
// Return the indexing info of the given kind in the given type. Creates synthetic union index types when necessary and
// maps primitive types and type parameters are to their apparent types.
function getIndexInfoOfType(type, kind) {
return getIndexInfoOfStructuredType(getApparentType(getReducedType(type)), kind);
return getIndexInfoOfStructuredType(getReducedApparentType(type), kind);
}
// Return the index type of the given kind in the given type. Creates synthetic union index types when necessary and
// maps primitive types and type parameters are to their apparent types.
function getIndexTypeOfType(type, kind) {
return getIndexTypeOfStructuredType(getApparentType(getReducedType(type)), kind);
return getIndexTypeOfStructuredType(getReducedApparentType(type), kind);
}
function getImplicitIndexTypeOfType(type, kind) {
if (isObjectTypeWithInferableIndex(type)) {
@ -46660,7 +46667,7 @@ var ts;
// In the following we resolve T[K] to the type of the property in T selected by K.
// We treat boolean as different from other unions to improve errors;
// skipping straight to getPropertyTypeForIndexType gives errors with 'boolean' instead of 'true'.
var apparentObjectType = getApparentType(getReducedType(objectType));
var apparentObjectType = getReducedApparentType(objectType);
if (indexType.flags & 1048576 /* Union */ && !(indexType.flags & 16 /* Boolean */)) {
var propTypes = [];
var wasMissingProp = false;
@ -56349,7 +56356,7 @@ var ts;
var right = _a[_i];
var left = props.get(right.escapedName);
var rightType = getTypeOfSymbol(right);
if (left && !maybeTypeOfKind(rightType, 98304 /* Nullable */) && !(maybeTypeOfKind(rightType, 1 /* Any */) && right.flags & 16777216 /* Optional */)) {
if (left && !maybeTypeOfKind(rightType, 98304 /* Nullable */) && !(maybeTypeOfKind(rightType, 3 /* AnyOrUnknown */) && right.flags & 16777216 /* Optional */)) {
var diagnostic = error(left.valueDeclaration, ts.Diagnostics._0_is_specified_more_than_once_so_this_usage_will_be_overwritten, ts.unescapeLeadingUnderscores(left.escapedName));
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(spread, ts.Diagnostics.This_spread_always_overwrites_this_property));
}
@ -77204,13 +77211,16 @@ var ts;
// Find original source text, since we need to emit the raw strings of the tagged template.
// The raw strings contain the (escaped) strings of what the user wrote.
// Examples: `\n` is converted to "\\n", a template string with a newline to "\n".
var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
// text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"),
// thus we need to remove those characters.
// First template piece starts with "`", others with "}"
// Last template piece ends with "`", others with "${"
var isLast = node.kind === 14 /* NoSubstitutionTemplateLiteral */ || node.kind === 17 /* TemplateTail */;
text = text.substring(1, text.length - (isLast ? 1 : 2));
var text = node.rawText;
if (text === undefined) {
text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
// text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"),
// thus we need to remove those characters.
// First template piece starts with "`", others with "}"
// Last template piece ends with "`", others with "${"
var isLast = node.kind === 14 /* NoSubstitutionTemplateLiteral */ || node.kind === 17 /* TemplateTail */;
text = text.substring(1, text.length - (isLast ? 1 : 2));
}
// Newline normalization:
// ES6 Spec 11.8.6.1 - Static Semantics of TV's and TRV's
// <CR><LF> and <CR> LineTerminatorSequences are normalized to <LF> for both TV and TRV.
@ -90353,7 +90363,7 @@ var ts;
scoped: false,
dependencies: [ts.createBindingHelper],
priority: 2,
text: "\n var __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);\n }"
text: "\n var __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);\n };"
};
function createExportStarHelper(context, module) {
context.requestEmitHelper(exportStarHelper);
@ -109672,8 +109682,8 @@ var ts;
* The default is CRLF.
*/
function getNewLineOrDefaultFromHost(host, formatSettings) {
return (formatSettings && formatSettings.newLineCharacter) ||
(host.getNewLine && host.getNewLine()) ||
var _a;
return (formatSettings === null || formatSettings === void 0 ? void 0 : formatSettings.newLineCharacter) || ((_a = host.getNewLine) === null || _a === void 0 ? void 0 : _a.call(host)) ||
carriageReturnLineFeed;
}
ts.getNewLineOrDefaultFromHost = getNewLineOrDefaultFromHost;
@ -119767,7 +119777,7 @@ var ts;
}
// Delete any subsequent imports.
for (var i = 1; i < oldImportDecls.length; i++) {
changeTracker.delete(sourceFile, oldImportDecls[i]);
changeTracker.deleteNode(sourceFile, oldImportDecls[i]);
}
}
}
@ -124237,8 +124247,8 @@ var ts;
(function (ts) {
var formatting;
(function (formatting) {
function getFormatContext(options) {
return { options: options, getRules: getRulesMap() };
function getFormatContext(options, host) {
return { options: options, getRules: getRulesMap(), host: host };
}
formatting.getFormatContext = getFormatContext;
var rulesMapCache;
@ -124651,7 +124661,7 @@ var ts;
return formatting.getFormattingScanner(sourceFile.text, sourceFile.languageVariant, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end, function (scanner) { return formatSpanWorker(originalRange, enclosingNode, formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, formatContext.options), getOwnOrInheritedDelta(enclosingNode, formatContext.options, sourceFile), scanner, formatContext, requestKind, prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange), sourceFile); });
}
function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delta, formattingScanner, _a, requestKind, rangeContainsError, sourceFile) {
var options = _a.options, getRules = _a.getRules;
var options = _a.options, getRules = _a.getRules, host = _a.host;
// formatting context is used by rules provider
var formattingContext = new formatting.FormattingContext(sourceFile, requestKind, options);
var previousRange;
@ -125321,7 +125331,7 @@ var ts;
// edit should not be applied if we have one line feed between elements
var lineDelta = currentStartLine - previousStartLine;
if (lineDelta !== 1) {
recordReplace(previousRange.end, currentRange.pos - previousRange.end, options.newLineCharacter);
recordReplace(previousRange.end, currentRange.pos - previousRange.end, ts.getNewLineOrDefaultFromHost(host, options));
return onLaterLine ? 0 /* None */ : 1 /* LineAdded */;
}
break;
@ -126204,6 +126214,10 @@ var ts;
ChangeTracker.prototype.delete = function (sourceFile, node) {
this.deletedNodes.push({ sourceFile: sourceFile, node: node });
};
ChangeTracker.prototype.deleteNode = function (sourceFile, node, options) {
if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; }
this.deleteRange(sourceFile, getAdjustedRange(sourceFile, node, node, options));
};
ChangeTracker.prototype.deleteModifier = function (sourceFile, modifier) {
this.deleteRange(sourceFile, { pos: modifier.getStart(sourceFile), end: ts.skipTrivia(sourceFile.text, modifier.end, /*stopAfterLineBreak*/ true) });
};
@ -138860,7 +138874,7 @@ var ts;
function getCompletionEntryDetails(fileName, position, name, formattingOptions, source, preferences) {
if (preferences === void 0) { preferences = ts.emptyOptions; }
synchronizeHostData();
return ts.Completions.getCompletionEntryDetails(program, log, getValidSourceFile(fileName), position, { name: name, source: source }, host, (formattingOptions && ts.formatting.getFormatContext(formattingOptions)), // TODO: GH#18217
return ts.Completions.getCompletionEntryDetails(program, log, getValidSourceFile(fileName), position, { name: name, source: source }, host, (formattingOptions && ts.formatting.getFormatContext(formattingOptions, host)), // TODO: GH#18217
preferences, cancellationToken);
}
function getCompletionEntrySymbol(fileName, position, name, source, preferences) {
@ -139132,14 +139146,14 @@ var ts;
}
function getFormattingEditsForRange(fileName, start, end, options) {
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
return ts.formatting.formatSelection(start, end, sourceFile, ts.formatting.getFormatContext(toEditorSettings(options)));
return ts.formatting.formatSelection(start, end, sourceFile, ts.formatting.getFormatContext(toEditorSettings(options), host));
}
function getFormattingEditsForDocument(fileName, options) {
return ts.formatting.formatDocument(syntaxTreeCache.getCurrentSourceFile(fileName), ts.formatting.getFormatContext(toEditorSettings(options)));
return ts.formatting.formatDocument(syntaxTreeCache.getCurrentSourceFile(fileName), ts.formatting.getFormatContext(toEditorSettings(options), host));
}
function getFormattingEditsAfterKeystroke(fileName, position, key, options) {
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
var formatContext = ts.formatting.getFormatContext(toEditorSettings(options));
var formatContext = ts.formatting.getFormatContext(toEditorSettings(options), host);
if (!ts.isInComment(sourceFile, position)) {
switch (key) {
case "{":
@ -139159,7 +139173,7 @@ var ts;
synchronizeHostData();
var sourceFile = getValidSourceFile(fileName);
var span = ts.createTextSpanFromBounds(start, end);
var formatContext = ts.formatting.getFormatContext(formatOptions);
var formatContext = ts.formatting.getFormatContext(formatOptions, host);
return ts.flatMap(ts.deduplicate(errorCodes, ts.equateValues, ts.compareValues), function (errorCode) {
cancellationToken.throwIfCancellationRequested();
return ts.codefix.getFixes({ errorCode: errorCode, sourceFile: sourceFile, span: span, program: program, host: host, cancellationToken: cancellationToken, formatContext: formatContext, preferences: preferences });
@ -139170,7 +139184,7 @@ var ts;
synchronizeHostData();
ts.Debug.assert(scope.type === "file");
var sourceFile = getValidSourceFile(scope.fileName);
var formatContext = ts.formatting.getFormatContext(formatOptions);
var formatContext = ts.formatting.getFormatContext(formatOptions, host);
return ts.codefix.getAllFixes({ fixId: fixId, sourceFile: sourceFile, program: program, host: host, cancellationToken: cancellationToken, formatContext: formatContext, preferences: preferences });
}
function organizeImports(scope, formatOptions, preferences) {
@ -139178,12 +139192,12 @@ var ts;
synchronizeHostData();
ts.Debug.assert(scope.type === "file");
var sourceFile = getValidSourceFile(scope.fileName);
var formatContext = ts.formatting.getFormatContext(formatOptions);
var formatContext = ts.formatting.getFormatContext(formatOptions, host);
return ts.OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences);
}
function getEditsForFileRename(oldFilePath, newFilePath, formatOptions, preferences) {
if (preferences === void 0) { preferences = ts.emptyOptions; }
return ts.getEditsForFileRename(getProgram(), oldFilePath, newFilePath, host, ts.formatting.getFormatContext(formatOptions), preferences, sourceMapper);
return ts.getEditsForFileRename(getProgram(), oldFilePath, newFilePath, host, ts.formatting.getFormatContext(formatOptions, host), preferences, sourceMapper);
}
function applyCodeActionCommand(fileName, actionOrFormatSettingsOrUndefined) {
var action = typeof fileName === "string" ? actionOrFormatSettingsOrUndefined : fileName;
@ -139385,7 +139399,7 @@ var ts;
endPosition: endPosition,
program: getProgram(),
host: host,
formatContext: ts.formatting.getFormatContext(formatOptions),
formatContext: ts.formatting.getFormatContext(formatOptions, host),
cancellationToken: cancellationToken,
preferences: preferences,
};
@ -145503,7 +145517,9 @@ var ts;
this.findConfiguredProjectByProjectName(configFileName);
return (project === null || project === void 0 ? void 0 : project.isSolution()) ?
project.getDefaultChildProjectFromSolution(info) :
project;
project && projectContainsInfoDirectly(project, info) ?
project :
undefined;
};
/**
* This function tries to search for a tsconfig.json for the given file.

View File

@ -244,7 +244,7 @@ var ts;
// If changing the text in this section, be sure to test `configurePrerelease` too.
ts.versionMajorMinor = "3.9";
/** The version of the TypeScript compiler release */
ts.version = "3.9.2";
ts.version = "3.9.3";
/**
* Returns the native Map implementation if it is available and compatible (i.e. supports iteration).
*/
@ -44040,7 +44040,7 @@ var ts;
return type.resolvedProperties;
}
function getPropertiesOfType(type) {
type = getApparentType(getReducedType(type));
type = getReducedApparentType(type);
return type.flags & 3145728 /* UnionOrIntersection */ ?
getPropertiesOfUnionOrIntersectionType(type) :
getPropertiesOfObjectType(type);
@ -44373,6 +44373,13 @@ var ts;
t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType :
t;
}
function getReducedApparentType(type) {
// Since getApparentType may return a non-reduced union or intersection type, we need to perform
// type reduction both before and after obtaining the apparent type. For example, given a type parameter
// 'T extends A | B', the type 'T & X' becomes 'A & X | B & X' after obtaining the apparent type, and
// that type may need futher reduction to remove empty intersections.
return getReducedType(getApparentType(getReducedType(type)));
}
function createUnionOrIntersectionProperty(containingType, name) {
var singleProp;
var propSet;
@ -44583,7 +44590,7 @@ var ts;
* @param name a name of property to look up in a given type
*/
function getPropertyOfType(type, name) {
type = getApparentType(getReducedType(type));
type = getReducedApparentType(type);
if (type.flags & 524288 /* Object */) {
var resolved = resolveStructuredTypeMembers(type);
var symbol = resolved.members.get(name);
@ -44619,7 +44626,7 @@ var ts;
* maps primitive types and type parameters are to their apparent types.
*/
function getSignaturesOfType(type, kind) {
return getSignaturesOfStructuredType(getApparentType(getReducedType(type)), kind);
return getSignaturesOfStructuredType(getReducedApparentType(type), kind);
}
function getIndexInfoOfStructuredType(type, kind) {
if (type.flags & 3670016 /* StructuredType */) {
@ -44634,12 +44641,12 @@ var ts;
// Return the indexing info of the given kind in the given type. Creates synthetic union index types when necessary and
// maps primitive types and type parameters are to their apparent types.
function getIndexInfoOfType(type, kind) {
return getIndexInfoOfStructuredType(getApparentType(getReducedType(type)), kind);
return getIndexInfoOfStructuredType(getReducedApparentType(type), kind);
}
// Return the index type of the given kind in the given type. Creates synthetic union index types when necessary and
// maps primitive types and type parameters are to their apparent types.
function getIndexTypeOfType(type, kind) {
return getIndexTypeOfStructuredType(getApparentType(getReducedType(type)), kind);
return getIndexTypeOfStructuredType(getReducedApparentType(type), kind);
}
function getImplicitIndexTypeOfType(type, kind) {
if (isObjectTypeWithInferableIndex(type)) {
@ -46810,7 +46817,7 @@ var ts;
// In the following we resolve T[K] to the type of the property in T selected by K.
// We treat boolean as different from other unions to improve errors;
// skipping straight to getPropertyTypeForIndexType gives errors with 'boolean' instead of 'true'.
var apparentObjectType = getApparentType(getReducedType(objectType));
var apparentObjectType = getReducedApparentType(objectType);
if (indexType.flags & 1048576 /* Union */ && !(indexType.flags & 16 /* Boolean */)) {
var propTypes = [];
var wasMissingProp = false;
@ -56499,7 +56506,7 @@ var ts;
var right = _a[_i];
var left = props.get(right.escapedName);
var rightType = getTypeOfSymbol(right);
if (left && !maybeTypeOfKind(rightType, 98304 /* Nullable */) && !(maybeTypeOfKind(rightType, 1 /* Any */) && right.flags & 16777216 /* Optional */)) {
if (left && !maybeTypeOfKind(rightType, 98304 /* Nullable */) && !(maybeTypeOfKind(rightType, 3 /* AnyOrUnknown */) && right.flags & 16777216 /* Optional */)) {
var diagnostic = error(left.valueDeclaration, ts.Diagnostics._0_is_specified_more_than_once_so_this_usage_will_be_overwritten, ts.unescapeLeadingUnderscores(left.escapedName));
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(spread, ts.Diagnostics.This_spread_always_overwrites_this_property));
}
@ -77354,13 +77361,16 @@ var ts;
// Find original source text, since we need to emit the raw strings of the tagged template.
// The raw strings contain the (escaped) strings of what the user wrote.
// Examples: `\n` is converted to "\\n", a template string with a newline to "\n".
var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
// text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"),
// thus we need to remove those characters.
// First template piece starts with "`", others with "}"
// Last template piece ends with "`", others with "${"
var isLast = node.kind === 14 /* NoSubstitutionTemplateLiteral */ || node.kind === 17 /* TemplateTail */;
text = text.substring(1, text.length - (isLast ? 1 : 2));
var text = node.rawText;
if (text === undefined) {
text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
// text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"),
// thus we need to remove those characters.
// First template piece starts with "`", others with "}"
// Last template piece ends with "`", others with "${"
var isLast = node.kind === 14 /* NoSubstitutionTemplateLiteral */ || node.kind === 17 /* TemplateTail */;
text = text.substring(1, text.length - (isLast ? 1 : 2));
}
// Newline normalization:
// ES6 Spec 11.8.6.1 - Static Semantics of TV's and TRV's
// <CR><LF> and <CR> LineTerminatorSequences are normalized to <LF> for both TV and TRV.
@ -90503,7 +90513,7 @@ var ts;
scoped: false,
dependencies: [ts.createBindingHelper],
priority: 2,
text: "\n var __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);\n }"
text: "\n var __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);\n };"
};
function createExportStarHelper(context, module) {
context.requestEmitHelper(exportStarHelper);
@ -110195,8 +110205,8 @@ var ts;
* The default is CRLF.
*/
function getNewLineOrDefaultFromHost(host, formatSettings) {
return (formatSettings && formatSettings.newLineCharacter) ||
(host.getNewLine && host.getNewLine()) ||
var _a;
return (formatSettings === null || formatSettings === void 0 ? void 0 : formatSettings.newLineCharacter) || ((_a = host.getNewLine) === null || _a === void 0 ? void 0 : _a.call(host)) ||
carriageReturnLineFeed;
}
ts.getNewLineOrDefaultFromHost = getNewLineOrDefaultFromHost;
@ -120290,7 +120300,7 @@ var ts;
}
// Delete any subsequent imports.
for (var i = 1; i < oldImportDecls.length; i++) {
changeTracker.delete(sourceFile, oldImportDecls[i]);
changeTracker.deleteNode(sourceFile, oldImportDecls[i]);
}
}
}
@ -124760,8 +124770,8 @@ var ts;
(function (ts) {
var formatting;
(function (formatting) {
function getFormatContext(options) {
return { options: options, getRules: getRulesMap() };
function getFormatContext(options, host) {
return { options: options, getRules: getRulesMap(), host: host };
}
formatting.getFormatContext = getFormatContext;
var rulesMapCache;
@ -125174,7 +125184,7 @@ var ts;
return formatting.getFormattingScanner(sourceFile.text, sourceFile.languageVariant, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end, function (scanner) { return formatSpanWorker(originalRange, enclosingNode, formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, formatContext.options), getOwnOrInheritedDelta(enclosingNode, formatContext.options, sourceFile), scanner, formatContext, requestKind, prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange), sourceFile); });
}
function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delta, formattingScanner, _a, requestKind, rangeContainsError, sourceFile) {
var options = _a.options, getRules = _a.getRules;
var options = _a.options, getRules = _a.getRules, host = _a.host;
// formatting context is used by rules provider
var formattingContext = new formatting.FormattingContext(sourceFile, requestKind, options);
var previousRange;
@ -125844,7 +125854,7 @@ var ts;
// edit should not be applied if we have one line feed between elements
var lineDelta = currentStartLine - previousStartLine;
if (lineDelta !== 1) {
recordReplace(previousRange.end, currentRange.pos - previousRange.end, options.newLineCharacter);
recordReplace(previousRange.end, currentRange.pos - previousRange.end, ts.getNewLineOrDefaultFromHost(host, options));
return onLaterLine ? 0 /* None */ : 1 /* LineAdded */;
}
break;
@ -126727,6 +126737,10 @@ var ts;
ChangeTracker.prototype.delete = function (sourceFile, node) {
this.deletedNodes.push({ sourceFile: sourceFile, node: node });
};
ChangeTracker.prototype.deleteNode = function (sourceFile, node, options) {
if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; }
this.deleteRange(sourceFile, getAdjustedRange(sourceFile, node, node, options));
};
ChangeTracker.prototype.deleteModifier = function (sourceFile, modifier) {
this.deleteRange(sourceFile, { pos: modifier.getStart(sourceFile), end: ts.skipTrivia(sourceFile.text, modifier.end, /*stopAfterLineBreak*/ true) });
};
@ -139383,7 +139397,7 @@ var ts;
function getCompletionEntryDetails(fileName, position, name, formattingOptions, source, preferences) {
if (preferences === void 0) { preferences = ts.emptyOptions; }
synchronizeHostData();
return ts.Completions.getCompletionEntryDetails(program, log, getValidSourceFile(fileName), position, { name: name, source: source }, host, (formattingOptions && ts.formatting.getFormatContext(formattingOptions)), // TODO: GH#18217
return ts.Completions.getCompletionEntryDetails(program, log, getValidSourceFile(fileName), position, { name: name, source: source }, host, (formattingOptions && ts.formatting.getFormatContext(formattingOptions, host)), // TODO: GH#18217
preferences, cancellationToken);
}
function getCompletionEntrySymbol(fileName, position, name, source, preferences) {
@ -139655,14 +139669,14 @@ var ts;
}
function getFormattingEditsForRange(fileName, start, end, options) {
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
return ts.formatting.formatSelection(start, end, sourceFile, ts.formatting.getFormatContext(toEditorSettings(options)));
return ts.formatting.formatSelection(start, end, sourceFile, ts.formatting.getFormatContext(toEditorSettings(options), host));
}
function getFormattingEditsForDocument(fileName, options) {
return ts.formatting.formatDocument(syntaxTreeCache.getCurrentSourceFile(fileName), ts.formatting.getFormatContext(toEditorSettings(options)));
return ts.formatting.formatDocument(syntaxTreeCache.getCurrentSourceFile(fileName), ts.formatting.getFormatContext(toEditorSettings(options), host));
}
function getFormattingEditsAfterKeystroke(fileName, position, key, options) {
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
var formatContext = ts.formatting.getFormatContext(toEditorSettings(options));
var formatContext = ts.formatting.getFormatContext(toEditorSettings(options), host);
if (!ts.isInComment(sourceFile, position)) {
switch (key) {
case "{":
@ -139682,7 +139696,7 @@ var ts;
synchronizeHostData();
var sourceFile = getValidSourceFile(fileName);
var span = ts.createTextSpanFromBounds(start, end);
var formatContext = ts.formatting.getFormatContext(formatOptions);
var formatContext = ts.formatting.getFormatContext(formatOptions, host);
return ts.flatMap(ts.deduplicate(errorCodes, ts.equateValues, ts.compareValues), function (errorCode) {
cancellationToken.throwIfCancellationRequested();
return ts.codefix.getFixes({ errorCode: errorCode, sourceFile: sourceFile, span: span, program: program, host: host, cancellationToken: cancellationToken, formatContext: formatContext, preferences: preferences });
@ -139693,7 +139707,7 @@ var ts;
synchronizeHostData();
ts.Debug.assert(scope.type === "file");
var sourceFile = getValidSourceFile(scope.fileName);
var formatContext = ts.formatting.getFormatContext(formatOptions);
var formatContext = ts.formatting.getFormatContext(formatOptions, host);
return ts.codefix.getAllFixes({ fixId: fixId, sourceFile: sourceFile, program: program, host: host, cancellationToken: cancellationToken, formatContext: formatContext, preferences: preferences });
}
function organizeImports(scope, formatOptions, preferences) {
@ -139701,12 +139715,12 @@ var ts;
synchronizeHostData();
ts.Debug.assert(scope.type === "file");
var sourceFile = getValidSourceFile(scope.fileName);
var formatContext = ts.formatting.getFormatContext(formatOptions);
var formatContext = ts.formatting.getFormatContext(formatOptions, host);
return ts.OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences);
}
function getEditsForFileRename(oldFilePath, newFilePath, formatOptions, preferences) {
if (preferences === void 0) { preferences = ts.emptyOptions; }
return ts.getEditsForFileRename(getProgram(), oldFilePath, newFilePath, host, ts.formatting.getFormatContext(formatOptions), preferences, sourceMapper);
return ts.getEditsForFileRename(getProgram(), oldFilePath, newFilePath, host, ts.formatting.getFormatContext(formatOptions, host), preferences, sourceMapper);
}
function applyCodeActionCommand(fileName, actionOrFormatSettingsOrUndefined) {
var action = typeof fileName === "string" ? actionOrFormatSettingsOrUndefined : fileName;
@ -139908,7 +139922,7 @@ var ts;
endPosition: endPosition,
program: getProgram(),
host: host,
formatContext: ts.formatting.getFormatContext(formatOptions),
formatContext: ts.formatting.getFormatContext(formatOptions, host),
cancellationToken: cancellationToken,
preferences: preferences,
};
@ -145653,7 +145667,9 @@ var ts;
this.findConfiguredProjectByProjectName(configFileName);
return (project === null || project === void 0 ? void 0 : project.isSolution()) ?
project.getDefaultChildProjectFromSolution(info) :
project;
project && projectContainsInfoDirectly(project, info) ?
project :
undefined;
};
/**
* This function tries to search for a tsconfig.json for the given file.

View File

@ -244,7 +244,7 @@ var ts;
// If changing the text in this section, be sure to test `configurePrerelease` too.
ts.versionMajorMinor = "3.9";
/** The version of the TypeScript compiler release */
ts.version = "3.9.2";
ts.version = "3.9.3";
/**
* Returns the native Map implementation if it is available and compatible (i.e. supports iteration).
*/
@ -44040,7 +44040,7 @@ var ts;
return type.resolvedProperties;
}
function getPropertiesOfType(type) {
type = getApparentType(getReducedType(type));
type = getReducedApparentType(type);
return type.flags & 3145728 /* UnionOrIntersection */ ?
getPropertiesOfUnionOrIntersectionType(type) :
getPropertiesOfObjectType(type);
@ -44373,6 +44373,13 @@ var ts;
t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType :
t;
}
function getReducedApparentType(type) {
// Since getApparentType may return a non-reduced union or intersection type, we need to perform
// type reduction both before and after obtaining the apparent type. For example, given a type parameter
// 'T extends A | B', the type 'T & X' becomes 'A & X | B & X' after obtaining the apparent type, and
// that type may need futher reduction to remove empty intersections.
return getReducedType(getApparentType(getReducedType(type)));
}
function createUnionOrIntersectionProperty(containingType, name) {
var singleProp;
var propSet;
@ -44583,7 +44590,7 @@ var ts;
* @param name a name of property to look up in a given type
*/
function getPropertyOfType(type, name) {
type = getApparentType(getReducedType(type));
type = getReducedApparentType(type);
if (type.flags & 524288 /* Object */) {
var resolved = resolveStructuredTypeMembers(type);
var symbol = resolved.members.get(name);
@ -44619,7 +44626,7 @@ var ts;
* maps primitive types and type parameters are to their apparent types.
*/
function getSignaturesOfType(type, kind) {
return getSignaturesOfStructuredType(getApparentType(getReducedType(type)), kind);
return getSignaturesOfStructuredType(getReducedApparentType(type), kind);
}
function getIndexInfoOfStructuredType(type, kind) {
if (type.flags & 3670016 /* StructuredType */) {
@ -44634,12 +44641,12 @@ var ts;
// Return the indexing info of the given kind in the given type. Creates synthetic union index types when necessary and
// maps primitive types and type parameters are to their apparent types.
function getIndexInfoOfType(type, kind) {
return getIndexInfoOfStructuredType(getApparentType(getReducedType(type)), kind);
return getIndexInfoOfStructuredType(getReducedApparentType(type), kind);
}
// Return the index type of the given kind in the given type. Creates synthetic union index types when necessary and
// maps primitive types and type parameters are to their apparent types.
function getIndexTypeOfType(type, kind) {
return getIndexTypeOfStructuredType(getApparentType(getReducedType(type)), kind);
return getIndexTypeOfStructuredType(getReducedApparentType(type), kind);
}
function getImplicitIndexTypeOfType(type, kind) {
if (isObjectTypeWithInferableIndex(type)) {
@ -46810,7 +46817,7 @@ var ts;
// In the following we resolve T[K] to the type of the property in T selected by K.
// We treat boolean as different from other unions to improve errors;
// skipping straight to getPropertyTypeForIndexType gives errors with 'boolean' instead of 'true'.
var apparentObjectType = getApparentType(getReducedType(objectType));
var apparentObjectType = getReducedApparentType(objectType);
if (indexType.flags & 1048576 /* Union */ && !(indexType.flags & 16 /* Boolean */)) {
var propTypes = [];
var wasMissingProp = false;
@ -56499,7 +56506,7 @@ var ts;
var right = _a[_i];
var left = props.get(right.escapedName);
var rightType = getTypeOfSymbol(right);
if (left && !maybeTypeOfKind(rightType, 98304 /* Nullable */) && !(maybeTypeOfKind(rightType, 1 /* Any */) && right.flags & 16777216 /* Optional */)) {
if (left && !maybeTypeOfKind(rightType, 98304 /* Nullable */) && !(maybeTypeOfKind(rightType, 3 /* AnyOrUnknown */) && right.flags & 16777216 /* Optional */)) {
var diagnostic = error(left.valueDeclaration, ts.Diagnostics._0_is_specified_more_than_once_so_this_usage_will_be_overwritten, ts.unescapeLeadingUnderscores(left.escapedName));
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(spread, ts.Diagnostics.This_spread_always_overwrites_this_property));
}
@ -77354,13 +77361,16 @@ var ts;
// Find original source text, since we need to emit the raw strings of the tagged template.
// The raw strings contain the (escaped) strings of what the user wrote.
// Examples: `\n` is converted to "\\n", a template string with a newline to "\n".
var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
// text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"),
// thus we need to remove those characters.
// First template piece starts with "`", others with "}"
// Last template piece ends with "`", others with "${"
var isLast = node.kind === 14 /* NoSubstitutionTemplateLiteral */ || node.kind === 17 /* TemplateTail */;
text = text.substring(1, text.length - (isLast ? 1 : 2));
var text = node.rawText;
if (text === undefined) {
text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
// text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"),
// thus we need to remove those characters.
// First template piece starts with "`", others with "}"
// Last template piece ends with "`", others with "${"
var isLast = node.kind === 14 /* NoSubstitutionTemplateLiteral */ || node.kind === 17 /* TemplateTail */;
text = text.substring(1, text.length - (isLast ? 1 : 2));
}
// Newline normalization:
// ES6 Spec 11.8.6.1 - Static Semantics of TV's and TRV's
// <CR><LF> and <CR> LineTerminatorSequences are normalized to <LF> for both TV and TRV.
@ -90503,7 +90513,7 @@ var ts;
scoped: false,
dependencies: [ts.createBindingHelper],
priority: 2,
text: "\n var __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);\n }"
text: "\n var __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);\n };"
};
function createExportStarHelper(context, module) {
context.requestEmitHelper(exportStarHelper);
@ -110195,8 +110205,8 @@ var ts;
* The default is CRLF.
*/
function getNewLineOrDefaultFromHost(host, formatSettings) {
return (formatSettings && formatSettings.newLineCharacter) ||
(host.getNewLine && host.getNewLine()) ||
var _a;
return (formatSettings === null || formatSettings === void 0 ? void 0 : formatSettings.newLineCharacter) || ((_a = host.getNewLine) === null || _a === void 0 ? void 0 : _a.call(host)) ||
carriageReturnLineFeed;
}
ts.getNewLineOrDefaultFromHost = getNewLineOrDefaultFromHost;
@ -120290,7 +120300,7 @@ var ts;
}
// Delete any subsequent imports.
for (var i = 1; i < oldImportDecls.length; i++) {
changeTracker.delete(sourceFile, oldImportDecls[i]);
changeTracker.deleteNode(sourceFile, oldImportDecls[i]);
}
}
}
@ -124760,8 +124770,8 @@ var ts;
(function (ts) {
var formatting;
(function (formatting) {
function getFormatContext(options) {
return { options: options, getRules: getRulesMap() };
function getFormatContext(options, host) {
return { options: options, getRules: getRulesMap(), host: host };
}
formatting.getFormatContext = getFormatContext;
var rulesMapCache;
@ -125174,7 +125184,7 @@ var ts;
return formatting.getFormattingScanner(sourceFile.text, sourceFile.languageVariant, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end, function (scanner) { return formatSpanWorker(originalRange, enclosingNode, formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, formatContext.options), getOwnOrInheritedDelta(enclosingNode, formatContext.options, sourceFile), scanner, formatContext, requestKind, prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange), sourceFile); });
}
function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delta, formattingScanner, _a, requestKind, rangeContainsError, sourceFile) {
var options = _a.options, getRules = _a.getRules;
var options = _a.options, getRules = _a.getRules, host = _a.host;
// formatting context is used by rules provider
var formattingContext = new formatting.FormattingContext(sourceFile, requestKind, options);
var previousRange;
@ -125844,7 +125854,7 @@ var ts;
// edit should not be applied if we have one line feed between elements
var lineDelta = currentStartLine - previousStartLine;
if (lineDelta !== 1) {
recordReplace(previousRange.end, currentRange.pos - previousRange.end, options.newLineCharacter);
recordReplace(previousRange.end, currentRange.pos - previousRange.end, ts.getNewLineOrDefaultFromHost(host, options));
return onLaterLine ? 0 /* None */ : 1 /* LineAdded */;
}
break;
@ -126727,6 +126737,10 @@ var ts;
ChangeTracker.prototype.delete = function (sourceFile, node) {
this.deletedNodes.push({ sourceFile: sourceFile, node: node });
};
ChangeTracker.prototype.deleteNode = function (sourceFile, node, options) {
if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; }
this.deleteRange(sourceFile, getAdjustedRange(sourceFile, node, node, options));
};
ChangeTracker.prototype.deleteModifier = function (sourceFile, modifier) {
this.deleteRange(sourceFile, { pos: modifier.getStart(sourceFile), end: ts.skipTrivia(sourceFile.text, modifier.end, /*stopAfterLineBreak*/ true) });
};
@ -139383,7 +139397,7 @@ var ts;
function getCompletionEntryDetails(fileName, position, name, formattingOptions, source, preferences) {
if (preferences === void 0) { preferences = ts.emptyOptions; }
synchronizeHostData();
return ts.Completions.getCompletionEntryDetails(program, log, getValidSourceFile(fileName), position, { name: name, source: source }, host, (formattingOptions && ts.formatting.getFormatContext(formattingOptions)), // TODO: GH#18217
return ts.Completions.getCompletionEntryDetails(program, log, getValidSourceFile(fileName), position, { name: name, source: source }, host, (formattingOptions && ts.formatting.getFormatContext(formattingOptions, host)), // TODO: GH#18217
preferences, cancellationToken);
}
function getCompletionEntrySymbol(fileName, position, name, source, preferences) {
@ -139655,14 +139669,14 @@ var ts;
}
function getFormattingEditsForRange(fileName, start, end, options) {
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
return ts.formatting.formatSelection(start, end, sourceFile, ts.formatting.getFormatContext(toEditorSettings(options)));
return ts.formatting.formatSelection(start, end, sourceFile, ts.formatting.getFormatContext(toEditorSettings(options), host));
}
function getFormattingEditsForDocument(fileName, options) {
return ts.formatting.formatDocument(syntaxTreeCache.getCurrentSourceFile(fileName), ts.formatting.getFormatContext(toEditorSettings(options)));
return ts.formatting.formatDocument(syntaxTreeCache.getCurrentSourceFile(fileName), ts.formatting.getFormatContext(toEditorSettings(options), host));
}
function getFormattingEditsAfterKeystroke(fileName, position, key, options) {
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
var formatContext = ts.formatting.getFormatContext(toEditorSettings(options));
var formatContext = ts.formatting.getFormatContext(toEditorSettings(options), host);
if (!ts.isInComment(sourceFile, position)) {
switch (key) {
case "{":
@ -139682,7 +139696,7 @@ var ts;
synchronizeHostData();
var sourceFile = getValidSourceFile(fileName);
var span = ts.createTextSpanFromBounds(start, end);
var formatContext = ts.formatting.getFormatContext(formatOptions);
var formatContext = ts.formatting.getFormatContext(formatOptions, host);
return ts.flatMap(ts.deduplicate(errorCodes, ts.equateValues, ts.compareValues), function (errorCode) {
cancellationToken.throwIfCancellationRequested();
return ts.codefix.getFixes({ errorCode: errorCode, sourceFile: sourceFile, span: span, program: program, host: host, cancellationToken: cancellationToken, formatContext: formatContext, preferences: preferences });
@ -139693,7 +139707,7 @@ var ts;
synchronizeHostData();
ts.Debug.assert(scope.type === "file");
var sourceFile = getValidSourceFile(scope.fileName);
var formatContext = ts.formatting.getFormatContext(formatOptions);
var formatContext = ts.formatting.getFormatContext(formatOptions, host);
return ts.codefix.getAllFixes({ fixId: fixId, sourceFile: sourceFile, program: program, host: host, cancellationToken: cancellationToken, formatContext: formatContext, preferences: preferences });
}
function organizeImports(scope, formatOptions, preferences) {
@ -139701,12 +139715,12 @@ var ts;
synchronizeHostData();
ts.Debug.assert(scope.type === "file");
var sourceFile = getValidSourceFile(scope.fileName);
var formatContext = ts.formatting.getFormatContext(formatOptions);
var formatContext = ts.formatting.getFormatContext(formatOptions, host);
return ts.OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences);
}
function getEditsForFileRename(oldFilePath, newFilePath, formatOptions, preferences) {
if (preferences === void 0) { preferences = ts.emptyOptions; }
return ts.getEditsForFileRename(getProgram(), oldFilePath, newFilePath, host, ts.formatting.getFormatContext(formatOptions), preferences, sourceMapper);
return ts.getEditsForFileRename(getProgram(), oldFilePath, newFilePath, host, ts.formatting.getFormatContext(formatOptions, host), preferences, sourceMapper);
}
function applyCodeActionCommand(fileName, actionOrFormatSettingsOrUndefined) {
var action = typeof fileName === "string" ? actionOrFormatSettingsOrUndefined : fileName;
@ -139908,7 +139922,7 @@ var ts;
endPosition: endPosition,
program: getProgram(),
host: host,
formatContext: ts.formatting.getFormatContext(formatOptions),
formatContext: ts.formatting.getFormatContext(formatOptions, host),
cancellationToken: cancellationToken,
preferences: preferences,
};

View File

@ -244,7 +244,7 @@ var ts;
// If changing the text in this section, be sure to test `configurePrerelease` too.
ts.versionMajorMinor = "3.9";
/** The version of the TypeScript compiler release */
ts.version = "3.9.2";
ts.version = "3.9.3";
/**
* Returns the native Map implementation if it is available and compatible (i.e. supports iteration).
*/
@ -44040,7 +44040,7 @@ var ts;
return type.resolvedProperties;
}
function getPropertiesOfType(type) {
type = getApparentType(getReducedType(type));
type = getReducedApparentType(type);
return type.flags & 3145728 /* UnionOrIntersection */ ?
getPropertiesOfUnionOrIntersectionType(type) :
getPropertiesOfObjectType(type);
@ -44373,6 +44373,13 @@ var ts;
t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType :
t;
}
function getReducedApparentType(type) {
// Since getApparentType may return a non-reduced union or intersection type, we need to perform
// type reduction both before and after obtaining the apparent type. For example, given a type parameter
// 'T extends A | B', the type 'T & X' becomes 'A & X | B & X' after obtaining the apparent type, and
// that type may need futher reduction to remove empty intersections.
return getReducedType(getApparentType(getReducedType(type)));
}
function createUnionOrIntersectionProperty(containingType, name) {
var singleProp;
var propSet;
@ -44583,7 +44590,7 @@ var ts;
* @param name a name of property to look up in a given type
*/
function getPropertyOfType(type, name) {
type = getApparentType(getReducedType(type));
type = getReducedApparentType(type);
if (type.flags & 524288 /* Object */) {
var resolved = resolveStructuredTypeMembers(type);
var symbol = resolved.members.get(name);
@ -44619,7 +44626,7 @@ var ts;
* maps primitive types and type parameters are to their apparent types.
*/
function getSignaturesOfType(type, kind) {
return getSignaturesOfStructuredType(getApparentType(getReducedType(type)), kind);
return getSignaturesOfStructuredType(getReducedApparentType(type), kind);
}
function getIndexInfoOfStructuredType(type, kind) {
if (type.flags & 3670016 /* StructuredType */) {
@ -44634,12 +44641,12 @@ var ts;
// Return the indexing info of the given kind in the given type. Creates synthetic union index types when necessary and
// maps primitive types and type parameters are to their apparent types.
function getIndexInfoOfType(type, kind) {
return getIndexInfoOfStructuredType(getApparentType(getReducedType(type)), kind);
return getIndexInfoOfStructuredType(getReducedApparentType(type), kind);
}
// Return the index type of the given kind in the given type. Creates synthetic union index types when necessary and
// maps primitive types and type parameters are to their apparent types.
function getIndexTypeOfType(type, kind) {
return getIndexTypeOfStructuredType(getApparentType(getReducedType(type)), kind);
return getIndexTypeOfStructuredType(getReducedApparentType(type), kind);
}
function getImplicitIndexTypeOfType(type, kind) {
if (isObjectTypeWithInferableIndex(type)) {
@ -46810,7 +46817,7 @@ var ts;
// In the following we resolve T[K] to the type of the property in T selected by K.
// We treat boolean as different from other unions to improve errors;
// skipping straight to getPropertyTypeForIndexType gives errors with 'boolean' instead of 'true'.
var apparentObjectType = getApparentType(getReducedType(objectType));
var apparentObjectType = getReducedApparentType(objectType);
if (indexType.flags & 1048576 /* Union */ && !(indexType.flags & 16 /* Boolean */)) {
var propTypes = [];
var wasMissingProp = false;
@ -56499,7 +56506,7 @@ var ts;
var right = _a[_i];
var left = props.get(right.escapedName);
var rightType = getTypeOfSymbol(right);
if (left && !maybeTypeOfKind(rightType, 98304 /* Nullable */) && !(maybeTypeOfKind(rightType, 1 /* Any */) && right.flags & 16777216 /* Optional */)) {
if (left && !maybeTypeOfKind(rightType, 98304 /* Nullable */) && !(maybeTypeOfKind(rightType, 3 /* AnyOrUnknown */) && right.flags & 16777216 /* Optional */)) {
var diagnostic = error(left.valueDeclaration, ts.Diagnostics._0_is_specified_more_than_once_so_this_usage_will_be_overwritten, ts.unescapeLeadingUnderscores(left.escapedName));
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(spread, ts.Diagnostics.This_spread_always_overwrites_this_property));
}
@ -77354,13 +77361,16 @@ var ts;
// Find original source text, since we need to emit the raw strings of the tagged template.
// The raw strings contain the (escaped) strings of what the user wrote.
// Examples: `\n` is converted to "\\n", a template string with a newline to "\n".
var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
// text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"),
// thus we need to remove those characters.
// First template piece starts with "`", others with "}"
// Last template piece ends with "`", others with "${"
var isLast = node.kind === 14 /* NoSubstitutionTemplateLiteral */ || node.kind === 17 /* TemplateTail */;
text = text.substring(1, text.length - (isLast ? 1 : 2));
var text = node.rawText;
if (text === undefined) {
text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
// text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"),
// thus we need to remove those characters.
// First template piece starts with "`", others with "}"
// Last template piece ends with "`", others with "${"
var isLast = node.kind === 14 /* NoSubstitutionTemplateLiteral */ || node.kind === 17 /* TemplateTail */;
text = text.substring(1, text.length - (isLast ? 1 : 2));
}
// Newline normalization:
// ES6 Spec 11.8.6.1 - Static Semantics of TV's and TRV's
// <CR><LF> and <CR> LineTerminatorSequences are normalized to <LF> for both TV and TRV.
@ -90503,7 +90513,7 @@ var ts;
scoped: false,
dependencies: [ts.createBindingHelper],
priority: 2,
text: "\n var __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);\n }"
text: "\n var __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);\n };"
};
function createExportStarHelper(context, module) {
context.requestEmitHelper(exportStarHelper);
@ -110195,8 +110205,8 @@ var ts;
* The default is CRLF.
*/
function getNewLineOrDefaultFromHost(host, formatSettings) {
return (formatSettings && formatSettings.newLineCharacter) ||
(host.getNewLine && host.getNewLine()) ||
var _a;
return (formatSettings === null || formatSettings === void 0 ? void 0 : formatSettings.newLineCharacter) || ((_a = host.getNewLine) === null || _a === void 0 ? void 0 : _a.call(host)) ||
carriageReturnLineFeed;
}
ts.getNewLineOrDefaultFromHost = getNewLineOrDefaultFromHost;
@ -120290,7 +120300,7 @@ var ts;
}
// Delete any subsequent imports.
for (var i = 1; i < oldImportDecls.length; i++) {
changeTracker.delete(sourceFile, oldImportDecls[i]);
changeTracker.deleteNode(sourceFile, oldImportDecls[i]);
}
}
}
@ -124760,8 +124770,8 @@ var ts;
(function (ts) {
var formatting;
(function (formatting) {
function getFormatContext(options) {
return { options: options, getRules: getRulesMap() };
function getFormatContext(options, host) {
return { options: options, getRules: getRulesMap(), host: host };
}
formatting.getFormatContext = getFormatContext;
var rulesMapCache;
@ -125174,7 +125184,7 @@ var ts;
return formatting.getFormattingScanner(sourceFile.text, sourceFile.languageVariant, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end, function (scanner) { return formatSpanWorker(originalRange, enclosingNode, formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, formatContext.options), getOwnOrInheritedDelta(enclosingNode, formatContext.options, sourceFile), scanner, formatContext, requestKind, prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange), sourceFile); });
}
function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delta, formattingScanner, _a, requestKind, rangeContainsError, sourceFile) {
var options = _a.options, getRules = _a.getRules;
var options = _a.options, getRules = _a.getRules, host = _a.host;
// formatting context is used by rules provider
var formattingContext = new formatting.FormattingContext(sourceFile, requestKind, options);
var previousRange;
@ -125844,7 +125854,7 @@ var ts;
// edit should not be applied if we have one line feed between elements
var lineDelta = currentStartLine - previousStartLine;
if (lineDelta !== 1) {
recordReplace(previousRange.end, currentRange.pos - previousRange.end, options.newLineCharacter);
recordReplace(previousRange.end, currentRange.pos - previousRange.end, ts.getNewLineOrDefaultFromHost(host, options));
return onLaterLine ? 0 /* None */ : 1 /* LineAdded */;
}
break;
@ -126727,6 +126737,10 @@ var ts;
ChangeTracker.prototype.delete = function (sourceFile, node) {
this.deletedNodes.push({ sourceFile: sourceFile, node: node });
};
ChangeTracker.prototype.deleteNode = function (sourceFile, node, options) {
if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; }
this.deleteRange(sourceFile, getAdjustedRange(sourceFile, node, node, options));
};
ChangeTracker.prototype.deleteModifier = function (sourceFile, modifier) {
this.deleteRange(sourceFile, { pos: modifier.getStart(sourceFile), end: ts.skipTrivia(sourceFile.text, modifier.end, /*stopAfterLineBreak*/ true) });
};
@ -139383,7 +139397,7 @@ var ts;
function getCompletionEntryDetails(fileName, position, name, formattingOptions, source, preferences) {
if (preferences === void 0) { preferences = ts.emptyOptions; }
synchronizeHostData();
return ts.Completions.getCompletionEntryDetails(program, log, getValidSourceFile(fileName), position, { name: name, source: source }, host, (formattingOptions && ts.formatting.getFormatContext(formattingOptions)), // TODO: GH#18217
return ts.Completions.getCompletionEntryDetails(program, log, getValidSourceFile(fileName), position, { name: name, source: source }, host, (formattingOptions && ts.formatting.getFormatContext(formattingOptions, host)), // TODO: GH#18217
preferences, cancellationToken);
}
function getCompletionEntrySymbol(fileName, position, name, source, preferences) {
@ -139655,14 +139669,14 @@ var ts;
}
function getFormattingEditsForRange(fileName, start, end, options) {
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
return ts.formatting.formatSelection(start, end, sourceFile, ts.formatting.getFormatContext(toEditorSettings(options)));
return ts.formatting.formatSelection(start, end, sourceFile, ts.formatting.getFormatContext(toEditorSettings(options), host));
}
function getFormattingEditsForDocument(fileName, options) {
return ts.formatting.formatDocument(syntaxTreeCache.getCurrentSourceFile(fileName), ts.formatting.getFormatContext(toEditorSettings(options)));
return ts.formatting.formatDocument(syntaxTreeCache.getCurrentSourceFile(fileName), ts.formatting.getFormatContext(toEditorSettings(options), host));
}
function getFormattingEditsAfterKeystroke(fileName, position, key, options) {
var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
var formatContext = ts.formatting.getFormatContext(toEditorSettings(options));
var formatContext = ts.formatting.getFormatContext(toEditorSettings(options), host);
if (!ts.isInComment(sourceFile, position)) {
switch (key) {
case "{":
@ -139682,7 +139696,7 @@ var ts;
synchronizeHostData();
var sourceFile = getValidSourceFile(fileName);
var span = ts.createTextSpanFromBounds(start, end);
var formatContext = ts.formatting.getFormatContext(formatOptions);
var formatContext = ts.formatting.getFormatContext(formatOptions, host);
return ts.flatMap(ts.deduplicate(errorCodes, ts.equateValues, ts.compareValues), function (errorCode) {
cancellationToken.throwIfCancellationRequested();
return ts.codefix.getFixes({ errorCode: errorCode, sourceFile: sourceFile, span: span, program: program, host: host, cancellationToken: cancellationToken, formatContext: formatContext, preferences: preferences });
@ -139693,7 +139707,7 @@ var ts;
synchronizeHostData();
ts.Debug.assert(scope.type === "file");
var sourceFile = getValidSourceFile(scope.fileName);
var formatContext = ts.formatting.getFormatContext(formatOptions);
var formatContext = ts.formatting.getFormatContext(formatOptions, host);
return ts.codefix.getAllFixes({ fixId: fixId, sourceFile: sourceFile, program: program, host: host, cancellationToken: cancellationToken, formatContext: formatContext, preferences: preferences });
}
function organizeImports(scope, formatOptions, preferences) {
@ -139701,12 +139715,12 @@ var ts;
synchronizeHostData();
ts.Debug.assert(scope.type === "file");
var sourceFile = getValidSourceFile(scope.fileName);
var formatContext = ts.formatting.getFormatContext(formatOptions);
var formatContext = ts.formatting.getFormatContext(formatOptions, host);
return ts.OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences);
}
function getEditsForFileRename(oldFilePath, newFilePath, formatOptions, preferences) {
if (preferences === void 0) { preferences = ts.emptyOptions; }
return ts.getEditsForFileRename(getProgram(), oldFilePath, newFilePath, host, ts.formatting.getFormatContext(formatOptions), preferences, sourceMapper);
return ts.getEditsForFileRename(getProgram(), oldFilePath, newFilePath, host, ts.formatting.getFormatContext(formatOptions, host), preferences, sourceMapper);
}
function applyCodeActionCommand(fileName, actionOrFormatSettingsOrUndefined) {
var action = typeof fileName === "string" ? actionOrFormatSettingsOrUndefined : fileName;
@ -139908,7 +139922,7 @@ var ts;
endPosition: endPosition,
program: getProgram(),
host: host,
formatContext: ts.formatting.getFormatContext(formatOptions),
formatContext: ts.formatting.getFormatContext(formatOptions, host),
cancellationToken: cancellationToken,
preferences: preferences,
};

View File

@ -83,7 +83,7 @@ var ts;
// If changing the text in this section, be sure to test `configurePrerelease` too.
ts.versionMajorMinor = "3.9";
/** The version of the TypeScript compiler release */
ts.version = "3.9.2";
ts.version = "3.9.3";
/**
* Returns the native Map implementation if it is available and compatible (i.e. supports iteration).
*/
@ -43879,7 +43879,7 @@ var ts;
return type.resolvedProperties;
}
function getPropertiesOfType(type) {
type = getApparentType(getReducedType(type));
type = getReducedApparentType(type);
return type.flags & 3145728 /* UnionOrIntersection */ ?
getPropertiesOfUnionOrIntersectionType(type) :
getPropertiesOfObjectType(type);
@ -44212,6 +44212,13 @@ var ts;
t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType :
t;
}
function getReducedApparentType(type) {
// Since getApparentType may return a non-reduced union or intersection type, we need to perform
// type reduction both before and after obtaining the apparent type. For example, given a type parameter
// 'T extends A | B', the type 'T & X' becomes 'A & X | B & X' after obtaining the apparent type, and
// that type may need futher reduction to remove empty intersections.
return getReducedType(getApparentType(getReducedType(type)));
}
function createUnionOrIntersectionProperty(containingType, name) {
var singleProp;
var propSet;
@ -44422,7 +44429,7 @@ var ts;
* @param name a name of property to look up in a given type
*/
function getPropertyOfType(type, name) {
type = getApparentType(getReducedType(type));
type = getReducedApparentType(type);
if (type.flags & 524288 /* Object */) {
var resolved = resolveStructuredTypeMembers(type);
var symbol = resolved.members.get(name);
@ -44458,7 +44465,7 @@ var ts;
* maps primitive types and type parameters are to their apparent types.
*/
function getSignaturesOfType(type, kind) {
return getSignaturesOfStructuredType(getApparentType(getReducedType(type)), kind);
return getSignaturesOfStructuredType(getReducedApparentType(type), kind);
}
function getIndexInfoOfStructuredType(type, kind) {
if (type.flags & 3670016 /* StructuredType */) {
@ -44473,12 +44480,12 @@ var ts;
// Return the indexing info of the given kind in the given type. Creates synthetic union index types when necessary and
// maps primitive types and type parameters are to their apparent types.
function getIndexInfoOfType(type, kind) {
return getIndexInfoOfStructuredType(getApparentType(getReducedType(type)), kind);
return getIndexInfoOfStructuredType(getReducedApparentType(type), kind);
}
// Return the index type of the given kind in the given type. Creates synthetic union index types when necessary and
// maps primitive types and type parameters are to their apparent types.
function getIndexTypeOfType(type, kind) {
return getIndexTypeOfStructuredType(getApparentType(getReducedType(type)), kind);
return getIndexTypeOfStructuredType(getReducedApparentType(type), kind);
}
function getImplicitIndexTypeOfType(type, kind) {
if (isObjectTypeWithInferableIndex(type)) {
@ -46649,7 +46656,7 @@ var ts;
// In the following we resolve T[K] to the type of the property in T selected by K.
// We treat boolean as different from other unions to improve errors;
// skipping straight to getPropertyTypeForIndexType gives errors with 'boolean' instead of 'true'.
var apparentObjectType = getApparentType(getReducedType(objectType));
var apparentObjectType = getReducedApparentType(objectType);
if (indexType.flags & 1048576 /* Union */ && !(indexType.flags & 16 /* Boolean */)) {
var propTypes = [];
var wasMissingProp = false;
@ -56338,7 +56345,7 @@ var ts;
var right = _a[_i];
var left = props.get(right.escapedName);
var rightType = getTypeOfSymbol(right);
if (left && !maybeTypeOfKind(rightType, 98304 /* Nullable */) && !(maybeTypeOfKind(rightType, 1 /* Any */) && right.flags & 16777216 /* Optional */)) {
if (left && !maybeTypeOfKind(rightType, 98304 /* Nullable */) && !(maybeTypeOfKind(rightType, 3 /* AnyOrUnknown */) && right.flags & 16777216 /* Optional */)) {
var diagnostic = error(left.valueDeclaration, ts.Diagnostics._0_is_specified_more_than_once_so_this_usage_will_be_overwritten, ts.unescapeLeadingUnderscores(left.escapedName));
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(spread, ts.Diagnostics.This_spread_always_overwrites_this_property));
}
@ -77193,13 +77200,16 @@ var ts;
// Find original source text, since we need to emit the raw strings of the tagged template.
// The raw strings contain the (escaped) strings of what the user wrote.
// Examples: `\n` is converted to "\\n", a template string with a newline to "\n".
var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
// text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"),
// thus we need to remove those characters.
// First template piece starts with "`", others with "}"
// Last template piece ends with "`", others with "${"
var isLast = node.kind === 14 /* NoSubstitutionTemplateLiteral */ || node.kind === 17 /* TemplateTail */;
text = text.substring(1, text.length - (isLast ? 1 : 2));
var text = node.rawText;
if (text === undefined) {
text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
// text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"),
// thus we need to remove those characters.
// First template piece starts with "`", others with "}"
// Last template piece ends with "`", others with "${"
var isLast = node.kind === 14 /* NoSubstitutionTemplateLiteral */ || node.kind === 17 /* TemplateTail */;
text = text.substring(1, text.length - (isLast ? 1 : 2));
}
// Newline normalization:
// ES6 Spec 11.8.6.1 - Static Semantics of TV's and TRV's
// <CR><LF> and <CR> LineTerminatorSequences are normalized to <LF> for both TV and TRV.
@ -90342,7 +90352,7 @@ var ts;
scoped: false,
dependencies: [ts.createBindingHelper],
priority: 2,
text: "\n var __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);\n }"
text: "\n var __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);\n };"
};
function createExportStarHelper(context, module) {
context.requestEmitHelper(exportStarHelper);