-
-
Notifications
You must be signed in to change notification settings - Fork 764
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
8.0.2 types causing #995
Comments
I have also observed this, and other, type errors since upgrading to [email protected]:
|
Hey @Cretezy and @alexjamesmacpherson – do either of you have steps to repro these type issues? Check out this repo: https://github.com/isaachinman/next-i18next-typescript This is just the simple example, but using TypeScript. Would be great if someone could fork the above repo and make the changes necessary to exhibit the issue. |
This is my tsconfig.json: {
"compilerOptions": {
"target": "ES5",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"downlevelIteration": true,
"sourceMap": true
},
"exclude": ["node_modules"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
} As for more code, I am using export default appWithTranslation(wrapper.withRedux(RootApp)); |
@Cretezy If I copy/paste that |
@isaachinman My tsconfig contains both I've just cloned the repo you posted and played around with the tsconfig settings to reproduce the issue. Only change needed is to set
Here's the offending tsconfig from that repo for clarity:
That said, I'm not sure why my own project isn't adhering to the |
We also experience similar https://github.com/daritelska-platforma/frontend/pull/78/checks?check_run_id=1990501530 Failed to compile.
./node_modules/next-i18next/src/appWithTranslation.tsx:2:34
Type error: Could not find a declaration file for module 'hoist-non-react-statics'. '/home/runner/work/frontend/frontend/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/hoist-non-react-statics` if it exists or add a new declaration (.d.ts) file containing `declare module 'hoist-non-react-statics';`
1 | import React from 'react'
> 2 | import hoistNonReactStatics from 'hoist-non-react-statics'
| ^
3 | import { I18nextProvider } from 'react-i18next'
4 |
5 | import { createConfig } from './config/createConfig'
error Command failed with exit code 1. tsconfig.json {
"compilerOptions": {
"target": "ESNext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": false,
"checkJs": false,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"isolatedModules": true,
"noImplicitAny": true,
"noImplicitThis": true,
"strictBindCallApply": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"jsx": "preserve",
"baseUrl": "./src"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules", ".next"]
} I'm reporting it here, but it might need dedicated issue at some point |
OK, I think there are two steps to fixing this for users who have
I have already begun work on the first item. |
@alexjamesmacpherson I'm still getting the issue in the first message, as well as the one in #995 (comment) with |
For now, my workaround is to ignore build errors. |
closes i18next#995
closes i18next#995
closes i18next#995
closes i18next#995
@isaachinman I still have issues:
The true fix for this problem is to not include |
Just want to say that all TS issues should be fixed from v8.0.6. You can see an example here of a https://github.com/isaachinman/next-i18next-typescript |
@isaachinman Indeed it seems to be fixed with |
@isaachinman
my tsconfig
|
This might be relevant to this issue: https://stackoverflow.com/a/59562136 edit: in fact, browser isn't typed on NodeJS.Process at least in my @types/node version (14.14.10) |
@
Yes, but the |
For anyone who might find this helpful. Adding a declare namespace NodeJS {
interface Process {
browser: boolean;
}
} |
Isn't this an easy fix of just removing this process.browser completely? It shouldn't affect anything as window covers the same purpose. |
cc @felixmosh |
@NiloDrumond, I've tested it, Note, instead of adding the declaration file as suggested above, you can add the Note 2, you are using the The benefits of using |
Hi @isaachinman I am getting an error version 11.0
Same implementation above! code source |
@aaesis You probably need to use |
Describe the bug
Upgrading from 8.0.1 to 8.0.2 created an TypeScript:
Occurs in next-i18next version
When moving from 8.0.1 to 8.0.2 (likely the type inclusion caused it).
Steps to reproduce
Expected behaviour
No error caused from the type casting.
OS
The text was updated successfully, but these errors were encountered: