Skip to content

Commit

Permalink
update .d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Oct 4, 2022
1 parent 787b05e commit 808ac69
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions index.d.ts
Expand Up @@ -98,6 +98,11 @@ export interface OverwriteOptions {
contentOnly?: boolean;
}

export interface UpdateOptions {
storeName?: boolean;
overwrite?: boolean;
}

export default class MagicString {
constructor(str: string, options?: MagicStringOptions);
/**
Expand Down Expand Up @@ -155,13 +160,23 @@ export default class MagicString {
*/
move(start: number, end: number, index: number): MagicString;
/**
* __Note:__ It may be preferred to use `s.update(...)` instead
*
* Replaces the characters from `start` to `end` with `content`. The same restrictions as `s.remove()` apply.
*
* The fourth argument is optional. It can have a storeName property — if true, the original name will be stored
* for later inclusion in a sourcemap's names array — and a contentOnly property which determines whether only
* the content is overwritten, or anything that was appended/prepended to the range as well.
*/
overwrite(start: number, end: number, content: string, options?: boolean | OverwriteOptions): MagicString;
/**
* Replaces the characters from `start` to `end` with `content`. The same restrictions as `s.remove()` apply.
*
* The fourth argument is optional. It can have a storeName property — if true, the original name will be stored
* for later inclusion in a sourcemap's names array — and an overwrite property which determines whether only
* the content is overwritten, or anything that was appended/prepended to the range as well.
*/
update(start: number, end: number, content: string, options?: boolean | UpdateOptions): MagicString;
/**
* Prepends the string with the specified content.
*/
Expand Down

0 comments on commit 808ac69

Please sign in to comment.