Skip to content

fix: remove Partial from Dependency type - #1493

Open
dword-design wants to merge 1 commit into
sindresorhus:mainfrom
dword-design:remove-dependency-partial
Open

fix: remove Partial from Dependency type#1493
dword-design wants to merge 1 commit into
sindresorhus:mainfrom
dword-design:remove-dependency-partial

Conversation

@dword-design

@dword-design dword-design commented Aug 1, 2026

Copy link
Copy Markdown

Currently the Dependency type is a partial of Record<string, string>, which allows { 'type-fest': undefined }.

Tests are failing but I think they are not related.

@som-sm som-sm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR makes sense because undefined should not be allowed as a valid value. undefined should only come up while accessing an unknown property from an index signature, which can be enforced using noUncheckedIndexedAccess compiler option.

// @noUncheckedIndexedAccess: true
declare const x: {[x: string]: number};

const y = x.foo;
//=> number | undefined

// @ts-expect-error
x.bar = undefined; // Not allowed

But all instances of Partial<Record<... need fixing, not just Dependency.

Also, the failing tests are related to this change, so tests need to be updated as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants