is it safe to remove `"declaration": true,` from t...
# help
s
is it safe to remove
"declaration": true,
from tsconfig? it was causing me some headaches
specifically, this:
t
declaration: true generates types so anything consuming the package can access them
Safe to remove but shouldn't be necessary, let me look closer at your error later
s
it wants me to be incredibly explicit:
Copy code
export const main: Handler<LambdaInput, void> = ...
which shouldn’t be necessary
TypeScript can easily take things to a level of strictness where it inhibits productivity. and this was it for me 😄
t
I'm using Sentry as well I vaguely recall this let me see what I did
Copy code
export const handler = Sentry.AWSLambda.wrapHandler(
  async (event: APIGatewayProxyEventV2, context, callback) => {
  }
)
for an api gateway event
s
yeah, that’s what I did. even in a fresh SST project, too.. and it yells at me
t
hm you have @types/aws-lambda installed?
s
yeah
you want a reproduction on GitHub? I can put one up
t
yeah that would be helpful
s
You got it. Will do it when I get home
@thdxr here you go. I cut out almost everything and kept it pretty minimal. https://github.com/ffxsam/repro-sst-ts-error
I open src/services/media-processor/functions/argh.ts in VS Code and I see the TS error
huh. when I remove
@types/aws-lambda
, the error goes away
it has to do with Yarn 2+ too I think
this is probably some sort of bad package resolution on Yarn’s part. now I’m thinking this might be a Yarn bug
or, one of these packages is doing something that Yarn 1 doesn’t care about, and Yarn 2 is being strict about
@Frank @thdxr here’s what someone had to say about this issue, in case you’re curious:
t
Sorry forgot to reply here, yeah I saw that there were conflicting versions of @types/aws-lambda
Expected yarn to be smarter about htat
s
yarn dedupe
did fix it.
t
ah nice
s
does SST include
@types/aws-lambda
as a dev dependency out of the box?
t
I think our template might include it. It needs updating
s
yeah I see it in the typescript template. maybe it can be removed?
other packages already include it anyway
t
Yeah let me make an issue, this template needs to be updated in a few ways
s
Yarn 1 was very lax with a lot of stuff. with Yarn 2+, they made it more strict. also I think they’re right,
typescript
probably should be in
devDependencies