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

Regression on SetRequired #1020

Closed
raphaelboukara opened this issue Dec 25, 2024 · 2 comments
Closed

Regression on SetRequired #1020

raphaelboukara opened this issue Dec 25, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@raphaelboukara
Copy link

Bug description

Let's take the following code has an example:

import type { PackageJson, SetRequired } from 'type-fest';

type PackageJsonVersion = PackageJson['version'];
type PackageJsonVersionRequired = SetRequired<PackageJson, 'version'>['version'];

received

With [email protected] I get:

type PackageJsonVersion = string | undefined

type PackageJsonVersionRequired = ((string | number | boolean | JsonObject | JsonValue[] | readonly JsonValue[]) & (string | number | boolean | JsonObject | JsonValue[] | readonly JsonValue[] | undefined)) | null

expected

With [email protected] I get:

type PackageJsonVersion = string | undefined

type PackageJsonVersionRequired = string

Repro

https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBDAnmApnA3nACgQwMYDWOA5igFIDOEAdgDRwDKKMASigI4CuwUKAJnAC+cAGZQIIOAHIkqALQiUFGFIDcAWABQW2WlyES5KtQBqKKBWA04AXmz4ipSjQDaUgG7nLNKQF0Nmrr2Bk7GZhZW1GxcPPy2jMzR3Lx8ADz6jkY09B5ekVIAfG6eET7+QA

@raphaelboukara raphaelboukara added the bug Something isn't working label Dec 25, 2024
@som-sm
Copy link
Collaborator

som-sm commented Dec 25, 2024

This is related to index signatures, should be fixed with this PR.

@raphaelboukara
Copy link
Author

Thanks a lot
Fixed in 4.31.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants