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
Add recurseIntoArrays
option for PartialDeep
#400
Add recurseIntoArrays
option for PartialDeep
#400
Conversation
This change does not seem to be backwards compatible even though it was released in a minor version. |
@Nokel81 You need to be more specific. What exactly is it breaking? |
We have the following type: enum KubeObjectScope {
Namespace = 0,
Cluster = 1
}
interface BaseKubeJsonApiObjectMetadata<Namespaced extends KubeObjectScope> {
annotations?: Partial<Record<string, string>>;
clusterName?: string;
readonly creationTimestamp?: string;
readonly deletionGracePeriodSeconds?: number;
readonly deletionTimestamp?: string;
generateName?: string;
readonly generation?: number;
labels?: Partial<Record<string, string>>;
managedFields?: unknown[];
readonly name: string;
readonly namespace?: ScopedNamespace<Namespaced>;
readonly resourceVersion?: string;
readonly selfLink?: string;
readonly uid?: string;
[key: string]: unknown;
}
type KubeJsonApiObjectMetadata<Namespaced extends KubeObjectScope = KubeObjectScope> = BaseKubeJsonApiObjectMetadata<Namespaced> & (Namespaced extends KubeObjectScope.Namespace ? {
readonly namespace: string;
} : {});
type KubeObjectMetadata<Namespaced extends KubeObjectScope = KubeObjectScope> = KubeJsonApiObjectMetadata<Namespaced> & {
readonly selfLink: string;
readonly uid: string;
readonly name: string;
readonly resourceVersion: string;
};
// This is the important type
class KubeObject<Metadata extends KubeObjectMetadata<KubeObjectScope> = KubeObjectMetadata<KubeObjectScope>, Status = unknown, Spec = unknown> {} And we upgraded to version In our code we have something like the following:
And our consumer wraps that call with there own generic function of the same signature. But there is now the following type error:
|
@bbrk24 Can you look into this ^ |
@Nokel81 I'm unable to reproduce this in the playground, based on what information you've provided me. Could you provide either a playground link or a repo with a MRE so I can investigate this? |
Sure, here is a link to a playground |
Oh I see, this only occurs when you have two different versions of type-fest present at the same time. I think that can cause errors even from a patch-level change: as an obvious example, say a type mistakenly produces |
I am not quite sure that I agree that is a semver-patch change in the strictest sense because we are dealing with a type level library here. From the definition of semver-patch and semver-minor, both are supposed to be resilient to multiple versions, I thought. |
That's in reference to upgrading. If you have a codebase that works with 1.2.3, it should still work with 1.2.4. I don't believe the standard says anything about having different parts of the project use both at the same time. |
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
Closes #367
This PR adds the
{recurseIntoArrays: false}
option as discussed in that issue. The property is optional (i.e. you may pass{}
for the options) for forwards-compatibility: should there be more options in the future, such asrecurseIntoSets
, you may specify any one and not the rest.