Skip to content
This repository has been archived by the owner on Mar 12, 2023. It is now read-only.

TypeScript errors #5

Closed
tpaulshippy opened this issue Nov 22, 2022 · 3 comments
Closed

TypeScript errors #5

tpaulshippy opened this issue Nov 22, 2022 · 3 comments

Comments

@tpaulshippy
Copy link

How can I get past this?

> tsc --noEmit

node_modules/@remix-run/router/history.ts:349:30 - error TS6133: 'window' is declared but its value is never read.

349   function createBrowserHref(window: Window, to: To) {
                                 ~~~~~~

node_modules/@remix-run/router/utils.ts:332:5 - error TS2322: Type 'AgnosticRouteMatch<string, RouteObjectType>[] | null' is not assignable to type 'null'.
  Type 'AgnosticRouteMatch<string, RouteObjectType>[]' is not assignable to type 'null'.

332     matches = matchRouteBranch<string, RouteObjectType>(
        ~~~~~~~

node_modules/@remix-run/router/utils.ts:1149:31 - error TS6133: 'v' is declared but its value is never read.

1149     this.pendingKeys.forEach((v, k) => this.pendingKeys.delete(k));
                                   ~


Found 3 errors in 2 files.

Errors  Files
     1  node_modules/@remix-run/router/history.ts:349
     2  node_modules/@remix-run/router/utils.ts:332
ERROR: "test:types" exited with 2.
@tpaulshippy
Copy link
Author

I'm guessing it has to do with my tsconfig.json --

{
  "include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"],
  "compilerOptions": {
    "baseUrl": "./src",
    "sourceMap": true,
    "outDir": "dist",
    "target": "ES2020",
    "moduleResolution": "node",
    "module": "CommonJS",
    "resolveJsonModule": true,
    "jsx": "react-jsx",
    "strict": true,
    "noImplicitAny": false,
    "skipLibCheck": true,
    "lib": ["DOM", "DOM.Iterable", "esnext"],
    "esModuleInterop": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "allowJs": true,
    "isolatedModules": true,
    "noEmit": true,
    "forceConsistentCasingInFileNames": true,
    "paths": {
      "~/*": ["./src/*"]
    }
  }
}

@tpaulshippy
Copy link
Author

I was able to work around this issue by using https://www.typescriptlang.org/docs/handbook/project-references.html

@jrestall
Copy link
Owner

Hi @tpaulshippy, glad you found a workaround. I'll close this since you have a workaround and official remix testing helpers should be coming soon which should help with any TypeScript issues. remix-run/remix#4539

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

No branches or pull requests

2 participants