Skip to content

Commit 9c0efb0

Browse files
authored
fix(replace): add missing types for objectGuards option (#1818)
1 parent 97e17ce commit 9c0efb0

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

packages/replace/test/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const config: RollupOptions = {
1616
include: 'config.js',
1717
exclude: 'node_modules/**',
1818
delimiters: ['<@', '@>'],
19+
objectGuards: true,
1920
preventAssignment: true,
2021
VERSION: '1.0.0',
2122
ENVIRONMENT: JSON.stringify('development'),

packages/replace/types/index.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface RollupReplaceOptions {
1212
| Replacement
1313
| RollupReplaceOptions['include']
1414
| RollupReplaceOptions['values']
15+
| RollupReplaceOptions['objectGuards']
1516
| RollupReplaceOptions['preventAssignment'];
1617

1718
/**
@@ -33,6 +34,12 @@ export interface RollupReplaceOptions {
3334
* of `foo`, supply delimiters
3435
*/
3536
delimiters?: [string, string];
37+
/**
38+
* When replacing dot-separated object properties like `process.env.NODE_ENV`,
39+
* will also replace `typeof process` object guard checks against the objects
40+
* with the string `"object"`.
41+
*/
42+
objectGuards?: boolean;
3643
/**
3744
* Prevents replacing strings where they are followed by a single equals
3845
* sign.

0 commit comments

Comments
 (0)