Skip to content

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

Open
@leobastiani

Description

@leobastiani

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions