browser-refresh icon indicating copy to clipboard operation
browser-refresh copied to clipboard

Getting typings errors even though the typeRoots are set in my tsconfig.

Open flleeppyy opened this issue 5 years ago • 1 comments

"dev": "browser-refresh --require ts-node/register ./src/index.ts"

This is the command im using to run my servers backend.

"__dev": "cross-env nodemon --ext 'ts' --watch 'src' --exec 'cross-env NODE_ENV=development PORT=8080 ts-node --files ./src/index.ts'",

This is the old dev command I was using before trying browser-refresh

When running browser-refresh, i get typing errors, even though it was working perfectly before I used browser-refresh

/media/chen/storage/development/urlshortener/backend/node_modules/ts-node/src/index.ts:513
    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: ⨯ Unable to compile TypeScript:
src/index.ts:114:40 - error TS2339: Property 'realIp' does not exist on type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.

114     if (ipffffSplit !== undefined) req.realIp = ipffffSplit; else req.realIp = ip;
                                           ~~~~~~
src/index.ts:114:71 - error TS2339: Property 'realIp' does not exist on type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.

114     if (ipffffSplit !== undefined) req.realIp = ipffffSplit; else req.realIp = ip;
                                                                          ~~~~~~

    at createTSError (/media/chen/storage/development/urlshortener/backend/node_modules/ts-node/src/index.ts:513:12)
    at reportTSError (/media/chen/storage/development/urlshortener/backend/node_modules/ts-node/src/index.ts:517:19)
    at getOutput (/media/chen/storage/development/urlshortener/backend/node_modules/ts-node/src/index.ts:752:36)
    at Object.compile (/media/chen/storage/development/urlshortener/backend/node_modules/ts-node/src/index.ts:968:32)
    at Module.m._compile (/media/chen/storage/development/urlshortener/backend/node_modules/ts-node/src/index.ts:1056:42)
    at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Object.require.extensions.<computed> [as .ts] (/media/chen/storage/development/urlshortener/backend/node_modules/ts-node/src/index.ts:1059:12)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
App stopped unexpectedly

This is my tsconfig.json

{
  "compilerOptions": {
    "allowJs": false,
    "allowSyntheticDefaultImports": true,
    "alwaysStrict": true,
    "baseUrl": "./src",
    "checkJs": false,
    "declaration": false,
    "emitDecoratorMetadata": true,
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "importsNotUsedAsValues": "error",
    "incremental": true,
    "lib": ["es2020"],
    "module": "commonjs",
    "moduleResolution": "node",
    "noEmit": false,
    "noEmitOnError": true,
    "noImplicitAny": true,
    "noImplicitReturns": false,
    "noImplicitThis": true,
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    // "outDir": "./dist",
    "pretty": false,
    "removeComments": true,
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "sourceMap": false,
    "strict": true,
    "strictBindCallApply": true,
    "strictNullChecks": false,
    "suppressImplicitAnyIndexErrors": true,
    "inlineSourceMap": true,
    "target": "es2020",
    "typeRoots": ["./src/typings", "./node_modules/@types"],
  },
  "exclude": ["node_modules"],
  "include": ["./src/**/*"]
}

What's the problem here?

flleeppyy avatar Mar 08 '21 07:03 flleeppyy

I just realised this package is dead rip

flleeppyy avatar Mar 08 '21 07:03 flleeppyy