Skip to content

Commit 2815e77

Browse files
committed
fix(types): make options partial by default
1 parent de2faf1 commit 2815e77

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

index.d.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ export interface SourceMapOptions {
1212
* line - but they're quicker to generate and less bulky.
1313
* If sourcemap locations have been specified with s.addSourceMapLocation(), they will be used here.
1414
*/
15-
hires: boolean;
15+
hires?: boolean;
1616
/**
1717
* The filename where you plan to write the sourcemap.
1818
*/
19-
file: string;
19+
file?: string;
2020
/**
2121
* The filename of the file containing the original source.
2222
*/
23-
source: string;
23+
source?: string;
2424
/**
2525
* Whether to include the original content in the map's sourcesContent array.
2626
*/
27-
includeContent: boolean;
27+
includeContent?: boolean;
2828
}
2929

3030
export type SourceMapSegment =
@@ -56,7 +56,7 @@ export class SourceMap {
5656
toString(): string;
5757
/**
5858
* Returns a DataURI containing the sourcemap. Useful for doing this sort of thing:
59-
* `generateMap(options?: Partial<SourceMapOptions>): SourceMap;`
59+
* `generateMap(options?: SourceMapOptions): SourceMap;`
6060
*/
6161
toUrl(): string;
6262
}
@@ -66,8 +66,8 @@ export class Bundle {
6666
addSource(source: MagicString | { filename?: string, content: MagicString }): Bundle;
6767
append(str: string, options?: BundleOptions): Bundle;
6868
clone(): Bundle;
69-
generateMap(options?: Partial<SourceMapOptions>): SourceMap;
70-
generateDecodedMap(options?: Partial<SourceMapOptions>): DecodedSourceMap;
69+
generateMap(options?: SourceMapOptions): SourceMap;
70+
generateDecodedMap(options?: SourceMapOptions): DecodedSourceMap;
7171
getIndentString(): string;
7272
indent(indentStr?: string): Bundle;
7373
indentExclusionRanges: ExclusionRange | Array<ExclusionRange>;
@@ -84,13 +84,13 @@ export class Bundle {
8484
export type ExclusionRange = [ number, number ];
8585

8686
export interface MagicStringOptions {
87-
filename: string,
88-
indentExclusionRanges: ExclusionRange | Array<ExclusionRange>;
87+
filename?: string,
88+
indentExclusionRanges?: ExclusionRange | Array<ExclusionRange>;
8989
}
9090

9191
export interface IndentOptions {
92-
exclude: ExclusionRange | Array<ExclusionRange>;
93-
indentStart: boolean;
92+
exclude?: ExclusionRange | Array<ExclusionRange>;
93+
indentStart?: boolean;
9494
}
9595

9696
export interface OverwriteOptions {
@@ -99,7 +99,7 @@ export interface OverwriteOptions {
9999
}
100100

101101
export default class MagicString {
102-
constructor(str: string, options?: Partial<MagicStringOptions>);
102+
constructor(str: string, options?: MagicStringOptions);
103103
/**
104104
* Adds the specified character index (with respect to the original string) to sourcemap mappings, if `hires` is false.
105105
*/
@@ -127,12 +127,12 @@ export default class MagicString {
127127
/**
128128
* Generates a version 3 sourcemap.
129129
*/
130-
generateMap(options?: Partial<SourceMapOptions>): SourceMap;
130+
generateMap(options?: SourceMapOptions): SourceMap;
131131
/**
132132
* Generates a sourcemap object with raw mappings in array form, rather than encoded as a string.
133133
* Useful if you need to manipulate the sourcemap further, but most of the time you will use `generateMap` instead.
134134
*/
135-
generateDecodedMap(options?: Partial<SourceMapOptions>): DecodedSourceMap;
135+
generateDecodedMap(options?: SourceMapOptions): DecodedSourceMap;
136136
getIndentString(): string;
137137

138138
/**

0 commit comments

Comments
 (0)