Skip to content

Commit

Permalink
Improve ts declarations (#27)
Browse files Browse the repository at this point in the history
Co-authored-by: Valentin Semirulnik <[email protected]>
  • Loading branch information
dragomirtitian and 7rulnik authored Sep 8, 2024
1 parent 0f58a3f commit bd538e4
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions source-map.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ export interface MappedPosition extends Position {
}

export interface MappingItem {
source: string;
source: string | null;
generatedLine: number;
generatedColumn: number;
originalLine: number;
originalColumn: number;
name: string;
originalLine: number | null;
originalColumn: number | null;
name: string | null;
}

export class SourceMapConsumer {
Expand All @@ -51,29 +51,35 @@ export class SourceMapConsumer {
static LEAST_UPPER_BOUND: number;

constructor(rawSourceMap: RawSourceMap);
readonly file: string | undefined | null;
readonly sourceRoot: string | undefined | null;
readonly sourcesContent: readonly string[] | null | undefined;
readonly sources: readonly string[]

computeColumnSpans(): void;
originalPositionFor(generatedPosition: FindPosition): MappedPosition;
generatedPositionFor(originalPosition: SourceFindPosition): LineRange;
allGeneratedPositionsFor(originalPosition: MappedPosition): Position[];
hasContentsOfAllSources(): boolean;
sourceContentFor(source: string, returnNullOnMissing?: boolean): string;
sourceContentFor(source: string, returnNullOnMissing?: boolean): string | null;
eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void;
}

export interface Mapping {
generated: Position;
original: Position;
source: string;
name?: string;
original?: Position | null;
source?: string | null;
name?: string | null;
}

export class SourceMapGenerator {
constructor(startOfSourceMap?: StartOfSourceMap);
static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator;
static fromSourceMap(sourceMapConsumer: SourceMapConsumer, startOfSourceMap?: StartOfSourceMap): SourceMapGenerator;
addMapping(mapping: Mapping): void;
setSourceContent(sourceFile: string, sourceContent: string): void;
setSourceContent(sourceFile: string, sourceContent: string | null | undefined): void;
applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void;
toString(): string;
toJSON(): RawSourceMap;
}

export interface CodeWithSourceMap {
Expand Down

0 comments on commit bd538e4

Please sign in to comment.