Skip to content

chore(type-utils)!: remove IsNullableTypeOptions interface #8934

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

Merged
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
8 changes: 2 additions & 6 deletions packages/eslint-plugin/src/rules/no-unnecessary-condition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -622,13 +622,9 @@ export default createRule<Options, MessageId>({
if (prevType.isUnion()) {
const isOwnNullable = prevType.types.some(type => {
const signatures = type.getCallSignatures();
return signatures.some(sig =>
isNullableType(sig.getReturnType(), { allowUndefined: true }),
);
return signatures.some(sig => isNullableType(sig.getReturnType()));
});
return (
!isOwnNullable && isNullableType(prevType, { allowUndefined: true })
);
return !isOwnNullable && isNullableType(prevType);
}

return false;
Expand Down
16 changes: 1 addition & 15 deletions packages/type-utils/src/predicates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,10 @@ import { isTypeFlagSet } from './typeFlagUtils';

const log = debug('typescript-eslint:eslint-plugin:utils:types');

export interface IsNullableTypeOptions {
/**
* @deprecated - this flag no longer does anything and will be removed in the next major
*/
isReceiver?: boolean;
/**
* @deprecated - this flag no longer does anything and will be removed in the next major
*/
allowUndefined?: boolean;
}

/**
* Checks if the given type is (or accepts) nullable
*/
export function isNullableType(
type: ts.Type,
_deprecated?: IsNullableTypeOptions,
): boolean {
export function isNullableType(type: ts.Type): boolean {
return isTypeFlagSet(
type,
ts.TypeFlags.Any |
Expand Down
Loading