From 34c4f519109f353366b49c925669182d28f3dc63 Mon Sep 17 00:00:00 2001 From: Avi Vahl Date: Tue, 6 Jun 2017 03:51:05 +0300 Subject: [PATCH 1/2] Correct SourceMap/Options TypeScript definitions SourceMapOptions does not include most of SourceMap's keys. In addition, SourceMap's constructor receives a SourceMap type, for initializing the instance. --- index.d.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/index.d.ts b/index.d.ts index ebc9c1d..bb57d0e 100644 --- a/index.d.ts +++ b/index.d.ts @@ -7,15 +7,18 @@ declare module "magic-string" { export interface SourceMapOptions { hires: boolean; file: string; + source: string; + includeContent: boolean; + } + + class SourceMap { + constructor(properties: SourceMap); + file: string; sources: string[]; sourcesContent: string; - includeContent: boolean; names: string[]; mappings: string[]; - } - class SourceMap { - constructor(properties: SourceMapOptions); toString(): string; toUrl(): string; } From 91062285391d5f04bdf4ff97a573274526397cab Mon Sep 17 00:00:00 2001 From: Avi Vahl Date: Tue, 6 Jun 2017 04:01:11 +0300 Subject: [PATCH 2/2] class -> interface, as it's no being exported from package this way TypeScript enforces that its not used as a constructor in user code. --- index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index bb57d0e..8d1a6ab 100644 --- a/index.d.ts +++ b/index.d.ts @@ -11,8 +11,7 @@ declare module "magic-string" { includeContent: boolean; } - class SourceMap { - constructor(properties: SourceMap); + export interface SourceMap { file: string; sources: string[]; sourcesContent: string;