react-i18next icon indicating copy to clipboard operation
react-i18next copied to clipboard

Types are not working for setting "modelResultion": "bundle"

Open snake-py opened this issue 1 year ago • 3 comments

🐛 Bug Report

I updated my tsconfig.json to a differnt module resoltuion and now the ts key inference is not working anymore. Before I had it on Node.

 {
  "compilerOptions": {
    "target": "ES2020",
    "experimentalDecorators": true,
    "useDefineForClassFields": true,
    "lib": ["DOM", "DOM.Iterable", "ESNext"],
    "allowJs": false,
    "skipLibCheck": true,
    "esModuleInterop": false,
    "allowSyntheticDefaultImports": true,
    "allowImportingTsExtensions": true,
    "composite": true,
    "forceConsistentCasingInFileNames": true,
    "module": "ES2020",

    /* Bundler mode */
    "moduleResolution": "Bundler",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx",

    /* Linting */
    "strict": false,
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "noFallthroughCasesInSwitch": true,

    "baseUrl": "./",
    "paths": {
      "#/*": ["./src/*"],
      "#api/*": ["./src/api/*"],
      "#components/*": ["./src/UI/components/*"],
      "#layouts/*": ["./src/UI/layouts/*"],
      "#pages/*": ["./src/pages/*"],
      "#providers/*": ["./src/providers/*"],
      "#widgets/*": ["./src/UI/widgets/*"]
    }
  },
  "types": ["vite/client", "jest", "@types/testing-library__jest-dom", "@types/react", "node"],
  "include": [
    "./global.d.ts",
    "./src/**/*.ts",
    "./src/**/*.tsx",
    "./src/**/*.json",
    "package.json",
    "jest.setup.js",
    "./src/errors/**/*.ts"
  ],
  "references": [{ "path": "./tsconfig.node.json" }],
  "exclude": ["**/*.test.ts", "**/*.test.tsx", "./dist/**/*", "node_modules", "**/*.svg", "./example/**/*"]
}

and suddenly I get image

Using:

    "i18next": "^23.14.0",
    "i18next-browser-languagedetector": "^8.0.0",
    "i18next-http-backend": "^2.6.1",
    "i18next-resources-to-backend": "^1.2.1",
    "react-i18next": "^15.0.1",

snake-py avatar Aug 21 '24 16:08 snake-py

please provide a minimal reproducible example repository

adrai avatar Aug 24 '24 05:08 adrai

//cc @marcalexiei @ripecosta

adrai avatar Aug 24 '24 05:08 adrai

I'm using "moduleResolution": "bundler" in one of my projects and types are working correctly so that shouldn't be the cause for this issue. At least not on its own. It'd be great to have a minimal reproducible example repository to poke through and figure it out.

ripecosta avatar Aug 25 '24 13:08 ripecosta

I experienced something similar, where the hooks warned with:

Type at position 1 in source is not compatible with type at position 1 in target.
      Type '{ entityType: "Type"; }' is not assignable to type 'string'

It seems like it manifests if I have strictNullChecks: false in tsconfig, and looking at the OPs config, it says strict: false, which might be the issue then.

osadi avatar Sep 25 '24 18:09 osadi

Thanks for the additional info. I tried switching both strict and strictNullChecks to false in the project where I use "moduleResolution": "bundler" and still couldn't reproduce.

We'll need a minimal reproducible example repository to to able to debug.

ripecosta avatar Oct 01 '24 16:10 ripecosta

I had to do a lot of different stuff. I will revisit this within this month. If I still have the issue I will post the repo. But for now I will assume that I won't have it again and close the issue in the mean time.

snake-py avatar Oct 02 '24 16:10 snake-py