i18next / react-i18next

Internationalization for react done right. Using the i18next i18n ecosystem.
https://react.i18next.com
MIT License
9.21k stars 1.02k forks source link

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

Open snake-py opened 3 weeks ago

snake-py commented 3 weeks ago

🐛 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",
adrai commented 3 weeks ago

please provide a minimal reproducible example repository

adrai commented 3 weeks ago

//cc @marcalexiei @ripecosta

ripecosta commented 3 weeks ago

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.