https://serverless-stack.com/ logo
#sst
Title
# sst
a

Adrián Mouly

08/27/2021, 5:15 PM
Is there a way to avoid type-checking over dependencies? Middy apparently imports x-ray, but I’m not using that.
t

thdxr

08/27/2021, 5:16 PM
what does your tsconfig look like?
a

Adrián Mouly

08/27/2021, 5:16 PM
Copy code
{
  "compilerOptions": {
    "target": "ES2018",
    "module": "commonjs",
    "lib": [
      "es2018"
    ],
    "declaration": true,
    "strict": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "noImplicitThis": true,
    "alwaysStrict": true,
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": false,
    "inlineSourceMap": true,
    "inlineSources": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "strictPropertyInitialization": false,
    "typeRoots": [
      "./node_modules/@types"
    ],
    "paths": {
      "@heyyabble/*": [
        "./src/packages/*"
      ]
    }
  },
  "include": [
    "lib",
    "src"
  ]
}
Not sure why is checking the node_modules apparently.
I’m using version 0.39.0 by the way, due the problem on empty-stacks.
t

thdxr

08/27/2021, 5:26 PM
this tsconfig.json is in the same directory as sst.json ?
a

Adrián Mouly

08/27/2021, 5:50 PM
Yes sir.
Is the only one I have.
It shouldn’t check the node_modules right?
t

thdxr

08/27/2021, 5:56 PM
yeah it shouldn't that's strange
a

Adrián Mouly

08/27/2021, 5:57 PM
Going to upgrade to latest sst.
t

thdxr

08/27/2021, 5:57 PM
Oh this isn't a type checking error this is a compilation error. Can you add that package and see if it fixes it?
a

Adrián Mouly

08/27/2021, 5:57 PM
Mmm.
This is a type error after I enabled type check.
Copy code
"lint": true,
  "typeCheck": true
I had typeCheck: false
Due I had several issues.
And all worked fine with false.
Now that is true, I get this error.
Makes sense?
t

thdxr

08/27/2021, 6:00 PM
What I meant by type checking error is that it's not an error coming from type issues. The way this works is if
typeCheck: true
is on we run
tsc
. Then we run
esbuild
which doesn't do as much as
tsc
but is faster and ignores more since it does tree shaking. It seems typescript is seeing an optional dependency of middy and expecting it to exist. @Sam Hulick is also using middy - wonder if he saw this issue
a

Adrián Mouly

08/27/2021, 6:02 PM
Yeah, this dependency is not installed, not sure why Middy needs it.
s

Sam Hulick

08/27/2021, 6:03 PM
weird, I don’t have
aws-xray-sdk
anywhere in my proj. are you using yarn? if so, what does
yarn why aws-xray-sdk
show?
a

Adrián Mouly

08/27/2021, 6:03 PM
Yes, I just installed it and no errors anymore.
But well, for some reason my middy uses it.
Looks like SSM-middy uses it.
s

Sam Hulick

08/27/2021, 6:04 PM
ahh. I was gonna say, it’s probably a middy add-on
a

Adrián Mouly

08/27/2021, 6:04 PM
What a crap 😞
Is there a way to tell the type-check to ignore some folder?
Because is throwing some errors from my React folder.
Like…
Cannot find name 'Window'.
Looks like
react_router
is missing some stuff.
I think it’s because my
tsconfig
doesn’t know the DOM?
s

Sam Hulick

08/27/2021, 6:08 PM
do you have this in your tsconfig’s
compilerOptions
?
Copy code
"lib": ["ESNext", "DOM"],
a

Adrián Mouly

08/27/2021, 6:09 PM
I have
es2018
, but I just added dom to test.
Ok, adding
dom
works.
Is that ok? I don’t want my lambdas to be affected somehow.
s

Sam Hulick

08/27/2021, 6:10 PM
sure, it works ok for me. I don’t think it’ll affect building the code
a

Adrián Mouly

08/27/2021, 6:10 PM
Ok, hopefully, that’s the only concern I have when merging frontend and backend, haha.
It’s all TS .. but well.
t

thdxr

08/27/2021, 6:13 PM
I'm finally working on my opinionated typescript starter which should help situations like this
hopefully will have it done today
a

Adrián Mouly

08/27/2021, 6:13 PM
👍
Thanks guys.