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

MergeExclusive is broken when used together with Except or built-in Omit #200

Closed
dev-natalya opened this issue Apr 16, 2021 · 5 comments
Closed
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@dev-natalya
Copy link

Environment

{
  "typescript": "4.2.4",
  "type-fest": "1.0.2"
}

Problem

MergeExclusive is broken when used together with Except or the built-in Omit

How to reproduce

import type * as TF from "type-fest"
type a = TF.MergeExclusive<{ a: boolean }, { b: boolean}> & { c: boolean }
type b = Omit<a, "c">

const c: b = {
  a: true,
  b: true
}

Screenshots

Click to see the screenshots Screen Shot 2021-04-16 at 7 41 42 PM Screen Shot 2021-04-16 at 7 43 15 PM
@sindresorhus
Copy link
Owner

Do you have "strict": true enabled in your TS config?

@dev-natalya
Copy link
Author

@sindresorhus thank you for the reply.
Yes, I do.

This is my tsconfig.json:

{
  "exclude": ["**/node_modules", "**/.git", "**/dist", "**/tmp"],

  "compilerOptions": {
    "noEmit": true,
    "moduleResolution": "Node",
    "allowSyntheticDefaultImports": true,
    "allowJs": false,
    "checkJs": false,
    "skipLibCheck": true,

    "lib": ["esnext", "dom"],
    "module": "esnext",
    "target": "esnext",

    "sourceMap": true,
    "jsx": "react",
    "forceConsistentCasingInFileNames": true,
    "importHelpers": false,
    "resolveJsonModule": true,

    "strict": true,
    "noImplicitAny": false,
    "noUnusedLocals": false, // optimization happens during build
    "noUnusedParameters": false, // optimization happens during build

    "suppressImplicitAnyIndexErrors": true,

    "noEmitHelpers": true,
    "noErrorTruncation": true,
    "experimentalDecorators": true,

    "assumeChangesOnlyAffectDirectDependencies": true
  },

  "watchOptions": {
    // Use native file system events for files and directories
    "watchFile": "useFsEventsOnParentDirectory",
    "watchDirectory": "useFsEvents",

    // Poll files for updates more frequently
    // when they're updated a lot.
    "fallbackPolling": "dynamicPriority"
  }
}

@sindresorhus sindresorhus added bug Something isn't working help wanted Extra attention is needed labels Apr 19, 2021
@skarab42
Copy link
Collaborator

@natalya-kim @sindresorhus Seems to work with Except Playground.

@skarab42
Copy link
Collaborator

@sindresorhus The PR #263 introduced in v2.3.2 fix the issue with Expect and MergeExclusive (Playground) and since Omit does not support it natively, there is nothing we can do, then I close this issue.

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

No branches or pull requests

3 participants