Skip to content

Commit

Permalink
Add function to SourceMapConsumer TS interface (#439)
Browse files Browse the repository at this point in the history
This adds the `initialize(opts)` function (defined on
[`source-map-consumer.js`][1]) to the typescript interface for
`SourceMapConsumer`.

Fixes: #423

[1]: https://github.com/andersonvom/source-map/blob/07657671/lib/source-map-consumer.js#L29-L31

Co-authored-by: Anderson Mesquita <[email protected]>
  • Loading branch information
andersonvom and Anderson Mesquita authored May 2, 2021
1 parent 0765767 commit 58819f0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions source-map.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,23 @@ export interface CodeWithSourceMap {
map: SourceMapGenerator;
}

export interface SourceMappings {
"lib/mappings.wasm": SourceMapUrl | ArrayBuffer;
}

export interface SourceMapConsumer {
/**
* When using SourceMapConsumer outside of node.js, for example on the Web, it
* needs to know from what URL to load lib/mappings.wasm. You must inform it
* by calling initialize before constructing any SourceMapConsumers.
*
* @param mappings an object with the following property:
* - "lib/mappings.wasm": A String containing the URL of the
* lib/mappings.wasm file, or an ArrayBuffer with the contents of
* lib/mappings.wasm.
*/
initialize(mappings: SourceMappings): void;

/**
* Compute the last column for each generated mapping. The last column is
* inclusive.
Expand Down

0 comments on commit 58819f0

Please sign in to comment.