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

Fix typescript examples error #1868

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cskeogh
Copy link

@cskeogh cskeogh commented May 26, 2022

Fix error:
[0] src/App.tsx(9,34): error TS2769: No overload matches this call.
[0] Overload 1 of 2, '(props: (RouteProps<string, { [x: string]: string; }> & OmitNative<{}, keyof RouteProps<string, { [x: string]: string; }>>) | Readonly<RouteProps<string, { ...; }> & OmitNative<...>>): Route<...>', gave the following error.
[0] Type 'typeof Home' is not assignable to type 'ComponentType<RouteComponentProps<any, StaticContext, unknown>> | ComponentType'.
[0] Type 'typeof Home' is not assignable to type 'ComponentClass<RouteComponentProps<any, StaticContext, unknown>, any>'.
[0] The types of 'contextType.Provider.propTypes.children' are incompatible between these types.
[0] Type 'React.Validator<React.ReactNode>' is not assignable to type 'import("C:/Users/craig/Projects/razzle-line-numbers/node_modules/@types/react-router/node_modules/@types/react/index").Validator<import("C:/Users/craig/Projects/razzle-line-numbers/node_modules/@types/react-router/node_modules/@types/react/index").ReactNode>'.
[0] Type 'React.ReactNode' is not assignable to type 'import("C:/Users/craig/Projects/razzle-line-numbers/node_modules/@types/react-router/node_modules/@types/react/index").ReactNode'.
[0] Type '{}' is not assignable to type 'ReactNode'.
[0] Overload 2 of 2, '(props: RouteProps<string, { [x: string]: string; }> & OmitNative<{}, keyof RouteProps<string, { [x: string]: string; }>>, context: any): Route<...>', gave the following error.
[0] Type 'typeof Home' is not assignable to type 'ComponentType<RouteComponentProps<any, StaticContext, unknown>> | ComponentType'.

Inspired by:
vercel/next.js#35986
vercel/next.js#36019

Fixes #1867

Fix error:
[0] src/App.tsx(9,34): error TS2769: No overload matches this call.
[0]   Overload 1 of 2, '(props: (RouteProps<string, { [x: string]: string; }> & OmitNative<{}, keyof RouteProps<string, { [x: string]: string; }>>) | Readonly<RouteProps<string, { ...; }> & OmitNative<...>>): Route<...>', gave the following error.
[0]     Type 'typeof Home' is not assignable to type 'ComponentType<RouteComponentProps<any, StaticContext, unknown>> | ComponentType<any>'.
[0]       Type 'typeof Home' is not assignable to type 'ComponentClass<RouteComponentProps<any, StaticContext, unknown>, any>'.
[0]         The types of 'contextType.Provider.propTypes.children' are incompatible between these types.
[0]           Type 'React.Validator<React.ReactNode>' is not assignable to type 'import("C:/Users/craig/Projects/razzle-line-numbers/node_modules/@types/react-router/node_modules/@types/react/index").Validator<import("C:/Users/craig/Projects/razzle-line-numbers/node_modules/@types/react-router/node_modules/@types/react/index").ReactNode>'.
[0]             Type 'React.ReactNode' is not assignable to type 'import("C:/Users/craig/Projects/razzle-line-numbers/node_modules/@types/react-router/node_modules/@types/react/index").ReactNode'.
[0]               Type '{}' is not assignable to type 'ReactNode'.
[0]   Overload 2 of 2, '(props: RouteProps<string, { [x: string]: string; }> & OmitNative<{}, keyof RouteProps<string, { [x: string]: string; }>>, context: any): Route<...>', gave the following error.
[0]     Type 'typeof Home' is not assignable to type 'ComponentType<RouteComponentProps<any, StaticContext, unknown>> | ComponentType<any>'.

Inspired by:
vercel/next.js#35986
vercel/next.js#36019

Fixes jaredpalmer#1867
@vercel
Copy link

vercel bot commented May 26, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
razzle ✅ Ready (Inspect) Visit Preview May 26, 2022 at 11:43AM (UTC)

@silviubogan
Copy link
Contributor

I have discovered a new error.

❯ yarn start
yarn run v1.22.19
warning ../../package.json: No license field
$ concurrently "yarn start:tsc" "razzle start"
warning ../../package.json: No license field
$ tsc -b -w --preserveWatchOutput
[0] 
[0] 19:24:42 - Starting compilation in watch mode...
[0] 
[1]  WAIT  Compiling...
[1] 
[1] ℹ Compiling Client
[1] node:internal/crypto/hash:71
[1]   this[kHandle] = new _Hash(algorithm, xofLen);
[1]                   ^
[1] 
[1] Error: error:0308010C:digital envelope routines::unsupported
[1]     at new Hash (node:internal/crypto/hash:71:19)
[1]     at Object.createHash (node:crypto:133:10)
[1]     at module.exports (/home/silviub/pro/mireasa-si-banii/node_modules/webpack/lib/util/createHash.js:135:53)
[1]     at NormalModule._initBuildHash (/home/silviub/pro/mireasa-si-banii/node_modules/webpack/lib/NormalModule.js:417:16)
[1]     at handleParseError (/home/silviub/pro/mireasa-si-banii/node_modules/webpack/lib/NormalModule.js:471:10)
[1]     at /home/silviub/pro/mireasa-si-banii/node_modules/webpack/lib/NormalModule.js:503:5
[1]     at /home/silviub/pro/mireasa-si-banii/node_modules/webpack/lib/NormalModule.js:358:12
[1]     at /home/silviub/pro/mireasa-si-banii/node_modules/loader-runner/lib/LoaderRunner.js:373:3
[1]     at iterateNormalLoaders (/home/silviub/pro/mireasa-si-banii/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
[1]     at Array.<anonymous> (/home/silviub/pro/mireasa-si-banii/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
[1]     at Storage.finished (/home/silviub/pro/mireasa-si-banii/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
[1]     at /home/silviub/pro/mireasa-si-banii/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
[1]     at /home/silviub/pro/mireasa-si-banii/node_modules/graceful-fs/graceful-fs.js:123:16
[1]     at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
[1]   opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
[1]   library: 'digital envelope routines',
[1]   reason: 'unsupported',
[1]   code: 'ERR_OSSL_EVP_UNSUPPORTED'
[1] }
[1] 
[1] Node.js v18.9.0
[1] razzle start exited with code 1
[0] src/App.tsx(9,34): error TS2769: No overload matches this call.
[0]   Overload 1 of 2, '(props: (RouteProps<string, { [x: string]: string; }> & OmitNative<{}, keyof RouteProps<string, { [x: string]: string; }>>) | Readonly<RouteProps<string, { ...; }> & OmitNative<...>>): Route<...>', gave the following error.
[0]     Type 'typeof Home' is not assignable to type 'ComponentType<RouteComponentProps<any, StaticContext, unknown>> | ComponentType<any>'.
[0]       Type 'typeof Home' is not assignable to type 'ComponentClass<RouteComponentProps<any, StaticContext, unknown>, any>'.
[0]         The types of 'contextType.Provider.propTypes.children' are incompatible between these types.
[0]           Type 'React.Validator<React.ReactNode>' is not assignable to type 'import("/home/silviub/pro/mireasa-si-banii/node_modules/@types/react-router/node_modules/@types/react/index").Validator<import("/home/silviub/pro/mireasa-si-banii/node_modules/@types/react-router/node_modules/@types/react/index").ReactNode>'.
[0]             Type 'React.ReactNode' is not assignable to type 'import("/home/silviub/pro/mireasa-si-banii/node_modules/@types/react-router/node_modules/@types/react/index").ReactNode'.
[0]               Type '{}' is not assignable to type 'ReactNode'.
[0]   Overload 2 of 2, '(props: RouteProps<string, { [x: string]: string; }> & OmitNative<{}, keyof RouteProps<string, { [x: string]: string; }>>, context: any): Route<...>', gave the following error.
[0]     Type 'typeof Home' is not assignable to type 'ComponentType<RouteComponentProps<any, StaticContext, unknown>> | ComponentType<any>'.
[0] 
[0] 19:24:43 - Found 1 error. Watching for file changes.

It's the one starting with Error: error:0308010C:digital envelope routines::unsupported. I thought this is a good place to post this.

Reproducible example

nvm install 18.9.0
nvm use 18.9.0
npx [email protected] --example with-typescript my-test-project
cd my-test-project
yarn start
Software Version(s)
Razzle 4.2.17
Razzle Plugins with-typescript example
Node v18.9.0
Browser Chromium
npm/Yarn yarn v1.22.19
Operating System Manjaro Linux with latest updates
TypeScript 4.0.3
React 17.0.1

I see the old versions of TypeScript and React being used. I could take a look into upgrading these in the example after the bug presented above is solved.

@silviubogan
Copy link
Contributor

@fivethreeo Hi! Just targeting your attention because I thought this was a good place to post the previous message in here but now I am doubting myself. Do you still work on Razzle? Should I open a new issue?

@fivethreeo
Copy link
Collaborator

Moving here https://github.com/elzzad/dazzle

@fivethreeo
Copy link
Collaborator

@dtabuenc is helping out once babel loader is in help wanted on more plugins and docs

@silviubogan
Copy link
Contributor

@fivethreeo

Moving here https://github.com/elzzad/dazzle

I comprehend that I can post the message above in the Dazzle repo.

What is the history of Dazzle and its purpose? How stable it is? What breaking changes does it introduce? If it is the future, what would be an easy (starting) issue where I can help?

Thanks a lot and good luck 😃

@fivethreeo
Copy link
Collaborator

Same purpose as razzle, not ready yet so stability unknown. Porting plugins from the alpha branch of razzle. Porting plugins from master branch of razzle. Making parts of razzle default config into plugins. But first make babel work in dazzle.

@silviubogan
Copy link
Contributor

Same purpose as razzle, not ready yet so stability unknown. Porting plugins from the alpha branch of razzle. Porting plugins from master branch of razzle. Making parts of razzle default config into plugins. But first make babel work in dazzle.

@fivethreeo I want to give a try to help making babel work in dazzle. Should I start looking into the razzle code or directly into dazzle code? And in what branch? Eventually, a starting file? Any more indications? Thanks.

@fivethreeo
Copy link
Collaborator

@dtabuenc is working on babel over the weekend

@fivethreeo
Copy link
Collaborator

Join us on discord https://discord.gg/tK9ZgcwwKv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

create razzle-app with-typescript error: src/App.tsx(9,34): error TS2769: No overload matches this call
3 participants