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

valuesOf does not work with conditional types #44

Open
cad0p opened this issue Mar 12, 2023 · 0 comments
Open

valuesOf does not work with conditional types #44

cad0p opened this issue Mar 12, 2023 · 0 comments

Comments

@cad0p
Copy link

cad0p commented Mar 12, 2023

For example:

export interface Fruit {}

export interface Apple {
  apple: string
}

export type WhatIs<T extends Fruit> = T extends Apple
  ? 'anApple'
  : never;

Fails, while the simpler examples in the README work correctly.

There is also a hot reload issue while using it with React:

SyntaxError: Unexpected token _ in JSON at position 0
    at JSON.parse (<anonymous>)
    at /workspaces/esg-data-api/esg-dashboard/node_modules/ts-loader/dist/watch-run.js:82:39
    at /workspaces/esg-data-api/esg-dashboard/node_modules/react-scripts/node_modules/webpack/lib/dependencies/LoaderPlugin.js:152:16
    at /workspaces/esg-data-api/esg-dashboard/node_modules/react-scripts/node_modules/webpack/lib/Compilation.js:1935:5
    at /workspaces/esg-data-api/esg-dashboard/node_modules/react-scripts/node_modules/webpack/lib/util/AsyncQueue.js:352:5
    at Hook.eval [as callAsync] (eval at create (/workspaces/esg-data-api/esg-dashboard/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncQueue._handleResult (/workspaces/esg-data-api/esg-dashboard/node_modules/react-scripts/node_modules/webpack/lib/util/AsyncQueue.js:322:21)
    at /workspaces/esg-data-api/esg-dashboard/node_modules/react-scripts/node_modules/webpack/lib/util/AsyncQueue.js:305:11
    at /workspaces/esg-data-api/esg-dashboard/node_modules/react-scripts/node_modules/webpack/lib/Compilation.js:1396:15
    at /workspaces/esg-data-api/esg-dashboard/node_modules/react-scripts/node_modules/webpack/lib/HookWebpackError.js:68:3
    at _done (eval at create (/workspaces/esg-data-api/esg-dashboard/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at Hook.eval [as callAsync] (eval at create (/workspaces/esg-data-api/esg-dashboard/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:39:22)
    at Cache.store (/workspaces/esg-data-api/esg-dashboard/node_modules/react-scripts/node_modules/webpack/lib/Cache.js:107:20)
    at CacheFacade.store (/workspaces/esg-data-api/esg-dashboard/node_modules/react-scripts/node_modules/webpack/lib/CacheFacade.js:283:15)
    at /workspaces/esg-data-api/esg-dashboard/node_modules/react-scripts/node_modules/webpack/lib/Compilation.js:1387:26
    at /workspaces/esg-data-api/esg-dashboard/node_modules/react-scripts/node_modules/webpack/lib/NormalModule.js:1061:14
    at jobDone (/workspaces/esg-data-api/esg-dashboard/node_modules/react-scripts/node_modules/webpack/lib/FileSystemInfo.js:1995:5)
    at FileSystemInfo.createSnapshot (/workspaces/esg-data-api/esg-dashboard/node_modules/react-scripts/node_modules/webpack/lib/FileSystemInfo.js:2330:3)
    at handleBuildDone (/workspaces/esg-data-api/esg-dashboard/node_modules/react-scripts/node_modules/webpack/lib/NormalModule.js:1046:32)
    at handleParseResult (/workspaces/esg-data-api/esg-dashboard/node_modules/react-scripts/node_modules/webpack/lib/NormalModule.js:991:12)
    at /workspaces/esg-data-api/esg-dashboard/node_modules/react-scripts/node_modules/webpack/lib/NormalModule.js:1098:4
    at processResult (/workspaces/esg-data-api/esg-dashboard/node_modules/react-scripts/node_modules/webpack/lib/NormalModule.js:800:11)
    at /workspaces/esg-data-api/esg-dashboard/node_modules/react-scripts/node_modules/webpack/lib/NormalModule.js:860:5
    at /workspaces/esg-data-api/esg-dashboard/node_modules/loader-runner/lib/LoaderRunner.js:407:3
    at iterateNormalLoaders (/workspaces/esg-data-api/esg-dashboard/node_modules/loader-runner/lib/LoaderRunner.js:233:10)
    at iterateNormalLoaders (/workspaces/esg-data-api/esg-dashboard/node_modules/loader-runner/lib/LoaderRunner.js:240:10)
    at /workspaces/esg-data-api/esg-dashboard/node_modules/loader-runner/lib/LoaderRunner.js:255:3
    at context.callback (/workspaces/esg-data-api/esg-dashboard/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
    at /workspaces/esg-data-api/esg-dashboard/node_modules/react-scripts/node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js:94:7
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
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