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

Integrate types for the warn method #20224

Merged
merged 2 commits into from
Jan 10, 2024
Merged
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
15 changes: 9 additions & 6 deletions packages/@ember/debug/lib/warn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ if (DEBUG) {
@for @ember/debug
@static
@param {String} message A warning to display.
@param {Boolean} test An optional boolean. If falsy, the warning
will be displayed.
@param {Object} options An object that can be used to pass a unique
`id` for this warning. The `id` can be used by Ember debugging tools
@param {Boolean|Object} test An optional boolean. If falsy, the warning
will be displayed. If `test` is an object, the `test` parameter can
be used as the `options` parameter and the warning is displayed.
@param {Object} options
@param {String} options.id The `id` can be used by Ember debugging tools
to change the behavior (raise, log, or silence) for that specific warning.
The `id` should be namespaced by dots, e.g. "ember-debug.feature-flag-with-features-stripped"
@public
Expand All @@ -111,8 +112,10 @@ if (DEBUG) {
assert(missingOptionsDeprecation, Boolean(options));
assert(missingOptionsIdDeprecation, Boolean(options && options.id));

// SAFETY: we checked this by way of the `arguments` check above.
invoke('warn', message, test as boolean, options);
// SAFETY: we have explicitly assigned `false` if the user invoked the
// arity-2 version of the overload, so we know `test` is always either
// `undefined` or a `boolean` for type-safe callers.
invoke('warn', message, test as boolean | undefined, options);
};
}

Expand Down
Loading