-
Notifications
You must be signed in to change notification settings - Fork 604
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1985 from microsoft/octogonz/import-type
[api-extractor] Add support for "import type" imports
- Loading branch information
Showing
9 changed files
with
229 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
...ests/api-extractor-scenarios/etc/test-outputs/importType/api-extractor-scenarios.api.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
{ | ||
"metadata": { | ||
"toolPackage": "@microsoft/api-extractor", | ||
"toolVersion": "[test mode]", | ||
"schemaVersion": 1003, | ||
"oldestForwardsCompatibleVersion": 1001 | ||
}, | ||
"kind": "Package", | ||
"canonicalReference": "api-extractor-scenarios!", | ||
"docComment": "", | ||
"name": "api-extractor-scenarios", | ||
"members": [ | ||
{ | ||
"kind": "EntryPoint", | ||
"canonicalReference": "api-extractor-scenarios!", | ||
"name": "", | ||
"members": [ | ||
{ | ||
"kind": "Interface", | ||
"canonicalReference": "api-extractor-scenarios!A:interface", | ||
"docComment": "/**\n * @public\n */\n", | ||
"excerptTokens": [ | ||
{ | ||
"kind": "Content", | ||
"text": "export interface A extends " | ||
}, | ||
{ | ||
"kind": "Reference", | ||
"text": "Lib1Class", | ||
"canonicalReference": "api-extractor-lib1-test!Lib1Class:class" | ||
}, | ||
{ | ||
"kind": "Content", | ||
"text": " " | ||
} | ||
], | ||
"releaseTag": "Public", | ||
"name": "A", | ||
"members": [], | ||
"extendsTokenRanges": [ | ||
{ | ||
"startIndex": 1, | ||
"endIndex": 3 | ||
} | ||
] | ||
}, | ||
{ | ||
"kind": "Interface", | ||
"canonicalReference": "api-extractor-scenarios!B:interface", | ||
"docComment": "/**\n * @public\n */\n", | ||
"excerptTokens": [ | ||
{ | ||
"kind": "Content", | ||
"text": "export interface B extends " | ||
}, | ||
{ | ||
"kind": "Reference", | ||
"text": "Lib1Interface", | ||
"canonicalReference": "api-extractor-lib1-test!Lib1Interface:interface" | ||
}, | ||
{ | ||
"kind": "Content", | ||
"text": " " | ||
} | ||
], | ||
"releaseTag": "Public", | ||
"name": "B", | ||
"members": [], | ||
"extendsTokenRanges": [ | ||
{ | ||
"startIndex": 1, | ||
"endIndex": 3 | ||
} | ||
] | ||
}, | ||
{ | ||
"kind": "Interface", | ||
"canonicalReference": "api-extractor-scenarios!C:interface", | ||
"docComment": "/**\n * @public\n */\n", | ||
"excerptTokens": [ | ||
{ | ||
"kind": "Content", | ||
"text": "export interface C extends " | ||
}, | ||
{ | ||
"kind": "Reference", | ||
"text": "Renamed", | ||
"canonicalReference": "api-extractor-lib1-test!Lib1Interface:interface" | ||
}, | ||
{ | ||
"kind": "Content", | ||
"text": " " | ||
} | ||
], | ||
"releaseTag": "Public", | ||
"name": "C", | ||
"members": [], | ||
"extendsTokenRanges": [ | ||
{ | ||
"startIndex": 1, | ||
"endIndex": 3 | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
25 changes: 25 additions & 0 deletions
25
...-extractor-scenarios/etc/test-outputs/importType/api-extractor-scenarios.api.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
## API Report File for "api-extractor-scenarios" | ||
|
||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). | ||
```ts | ||
|
||
import type { Lib1Class } from 'api-extractor-lib1-test'; | ||
import { Lib1Interface } from 'api-extractor-lib1-test'; | ||
|
||
// @public (undocumented) | ||
export interface A extends Lib1Class { | ||
} | ||
|
||
// @public (undocumented) | ||
export interface B extends Lib1Interface { | ||
} | ||
|
||
// @public (undocumented) | ||
export interface C extends Lib1Interface { | ||
} | ||
|
||
|
||
// (No @packageDocumentation comment for this package) | ||
|
||
``` |
16 changes: 16 additions & 0 deletions
16
build-tests/api-extractor-scenarios/etc/test-outputs/importType/rollup.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { Lib1Class } from 'api-extractor-lib1-test'; | ||
import { Lib1Interface } from 'api-extractor-lib1-test'; | ||
|
||
/** @public */ | ||
export declare interface A extends Lib1Class { | ||
} | ||
|
||
/** @public */ | ||
export declare interface B extends Lib1Interface { | ||
} | ||
|
||
/** @public */ | ||
export declare interface C extends Lib1Interface { | ||
} | ||
|
||
export { } |
16 changes: 16 additions & 0 deletions
16
build-tests/api-extractor-scenarios/src/importType/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
|
||
import type { Lib1Class, Lib1Interface } from 'api-extractor-lib1-test'; | ||
|
||
// This should prevent Lib1Interface from being emitted as a type-only import, even though B uses it that way. | ||
import { Lib1Interface as Renamed } from 'api-extractor-lib1-test'; | ||
|
||
/** @public */ | ||
export interface A extends Lib1Class {} | ||
|
||
/** @public */ | ||
export interface B extends Lib1Interface {} | ||
|
||
/** @public */ | ||
export interface C extends Renamed {} |
11 changes: 11 additions & 0 deletions
11
common/changes/@microsoft/api-extractor/octogonz-import-type_2020-07-03-04-05.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@microsoft/api-extractor", | ||
"comment": "Add support for \"import type\" imports (new in TypeScript 3.8)", | ||
"type": "minor" | ||
} | ||
], | ||
"packageName": "@microsoft/api-extractor", | ||
"email": "[email protected]" | ||
} |