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

Except not removing keys as Omit does #114

Closed
xenoterracide opened this issue Jun 12, 2020 · 2 comments
Closed

Except not removing keys as Omit does #114

xenoterracide opened this issue Jun 12, 2020 · 2 comments

Comments

@xenoterracide
Copy link

xenoterracide commented Jun 12, 2020

export interface Identifiable<T> {
  readonly id: T;
}

export interface Entity<ID> extends Identifiable<ID> {
  readonly createdAt: ZonedDateTime;
  modifiedAt: ZonedDateTime;
}

export type EntityOpts<T extends Entity<unknown>> = Omit<
  Partial<T>,
  'id' | 'createdAt' | 'modifiedAt'
>;

replace Omit with Except in this code and all of the "excluded" keys will still be available for use and compile.

> yarn list typescript type-fest && node --version
yarn list v1.22.4
warning Filtering by arguments is deprecated. Please use the pattern option instead.
├─ @google-cloud/logging@4.5.2
│  └─ type-fest@0.3.1
├─ eslint@6.8.0
│  ├─ ansi-escapes@4.2.1
│  │  └─ type-fest@0.5.2
│  └─ type-fest@0.8.1
├─ inquirer@7.0.3
│  └─ type-fest@0.5.2
├─ meow@7.0.1
│  ├─ read-pkg-up@7.0.1
│  │  └─ type-fest@0.8.1
│  ├─ read-pkg@5.2.0
│  │  └─ type-fest@0.6.0
│  └─ type-fest@0.13.1
├─ type-fest@0.15.1
└─ typescript@3.7.4
✨  Done in 1.28s.
v12.16.3

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • The funding will be given to active contributors.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@sindresorhus
Copy link
Owner

Can you share a minimal example? (The least amount of self-contained code that reproduces the issue). Preferably as a TS playground.

@xenoterracide
Copy link
Author

now I've no idea what was going on, lol :/ I'll reopen or something later if I can figure it out...

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

2 participants