feat(api-extractor): replace type parameters with their actual values on inherited members (#9939)

* refactor: use tokenRange for typeParams in heritage

* fix: correct type param replacement
This commit is contained in:
Qjuh
2023-11-11 15:18:08 +01:00
committed by GitHub
parent 5b0aa92c81
commit 5a4c9755c3
8 changed files with 116 additions and 89 deletions

View File

@@ -44,7 +44,7 @@ export interface IApiClassOptions
}
export interface IExcerptTokenRangeWithTypeParameters extends IExcerptTokenRange {
typeParameters: string[];
typeParameters: IExcerptTokenRange[];
}
export interface IApiClassJson

View File

@@ -91,13 +91,18 @@ export enum ApiJsonSchemaVersion {
*/
V_1011 = 1_011,
/**
* Add a `fileLine`and `fileColumn` field to track source code location
*/
V_1012 = 1_012,
/**
* The current latest .api.json schema version.
*
* IMPORTANT: When incrementing this number, consider whether `OLDEST_SUPPORTED` or `OLDEST_FORWARDS_COMPATIBLE`
* should be updated.
*/
LATEST = V_1011,
LATEST = V_1012,
/**
* The oldest .api.json schema version that is still supported for backwards compatibility.

View File

@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import type { Excerpt } from '../mixins/Excerpt.js';
import type { Excerpt, IExcerptTokenRange } from '../mixins/Excerpt.js';
/**
* Represents a type referenced via an "extends" or "implements" heritage clause for a TypeScript class
@@ -38,9 +38,9 @@ export class HeritageType {
*/
public readonly excerpt: Excerpt;
public readonly typeParameters?: string[];
public readonly typeParameters?: IExcerptTokenRange[];
public constructor(excerpt: Excerpt, typeParameters: string[]) {
public constructor(excerpt: Excerpt, typeParameters: IExcerptTokenRange[]) {
this.excerpt = excerpt;
this.typeParameters = typeParameters;
}