Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(replace): add missing types for new preventAssignment option #813

Merged
merged 2 commits into from
Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/replace/test/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const config: RollupOptions = {
include: 'config.js',
exclude: 'node_modules/**',
delimiters: ['<@', '@>'],
preventAssignment: true,
VERSION: '1.0.0',
ENVIRONMENT: JSON.stringify('development'),
__dirname: (id) => `'${dirname(id)}'`,
Expand Down
11 changes: 10 additions & 1 deletion packages/replace/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ export interface RollupReplaceOptions {
* All other options are treated as `string: replacement` replacers,
* or `string: (id) => replacement` functions.
*/
[str: string]: Replacement | RollupReplaceOptions['include'] | RollupReplaceOptions['values'];
[str: string]:
| Replacement
| RollupReplaceOptions['include']
| RollupReplaceOptions['values']
| RollupReplaceOptions['preventAssignment'];

/**
* A minimatch pattern, or array of patterns, of files that should be
Expand All @@ -24,6 +28,11 @@ export interface RollupReplaceOptions {
* of `foo`, supply delimiters
*/
delimiters?: [string, string];
/**
* Prevents replacing strings where they are followed by a single equals
* sign.
*/
preventAssignment?: boolean;
/**
* You can separate values to replace from other options.
*/
Expand Down