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

Objects.Omit and Objects.Pick make all properties required #103

Open
leobastiani opened this issue Jun 18, 2023 · 0 comments
Open

Objects.Omit and Objects.Pick make all properties required #103

leobastiani opened this issue Jun 18, 2023 · 0 comments

Comments

@leobastiani
Copy link

leobastiani commented Jun 18, 2023

In version 1.0.11, Objects.Omit and Objects.Pick make all properties required. It also ignores readonly and make everything writable

https://codesandbox.io/s/typescript-playground-export-forked-5y6rtd

import { Pipe, Objects, Identity } from "hotscript";

type HasNoOptionals1 = Pipe<
//   ^?
  {
    readonly a: string;
    b: number;
    c?: boolean;
    d?: number;
  },
  [Objects.Omit<"a">]
>;

type HasNoOptionals2 = Pipe<
//   ^?
  {
    readonly a: string;
    b: number;
    c?: boolean;
    d?: number;
  },
  [Objects.Omit<"">]
>;

type HasNoOptionals3 = Pipe<
//   ^?
  {
    readonly a: string;
    b: number;
    c?: boolean;
    d?: number;
  },
  [Objects.Pick<"a" | "c">]
>;

type HasNoOptionals4 = Pipe<
//   ^?
  {
    readonly a: string;
    b: number;
    c?: boolean;
    d?: number;
  },
  [Objects.Pick<"a" | "b" | "c" | "d">]
>;

type WithIdentity = Pipe<
//   ^?
  {
    readonly a: string;
    b: number;
    c?: boolean;
    d?: number;
  },
  [Identity]
>;
Output
export {};
Compiler Options
{
  "compilerOptions": {
    "strict": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "strictPropertyInitialization": true,
    "strictBindCallApply": true,
    "noImplicitThis": true,
    "noImplicitReturns": true,
    "alwaysStrict": true,
    "esModuleInterop": true,
    "declaration": true,
    "target": "ES2017",
    "jsx": "react",
    "module": "ESNext",
    "moduleResolution": "node"
  }
}

Playground Link: Provided

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

No branches or pull requests

1 participant