I’ve got some `tsconfig.path` weirdness going on, ...
# help
s
I’ve got some
tsconfig.path
weirdness going on, specifically with
paths
aliases. I have this in my config:
Copy code
{
  "compilerOptions": {
    "baseUrl": "src",
    "paths": {
      "@libs/*": ["libs/*"]
    },
    // ..etc
and yet when I try to use this shortcut in my code:
f
Hey Sam, i know you mentioned in another thread where you see an error in ur IDE but not on
sst build
. Do you also get the same error on
sst build
in this case?
s
well, per the previously mentioned issue, SST doesn’t care if an import is invalid
so there’s no error
d
@Sam Hulick you know, i’ve solved this by putting an index.ts in the root dir of my libs and doing this import/export dance: import * as User from “./user”; export { User };
s
definitely not ideal. 😕 and shouldn’t be required to fix this path issue
just made a fresh folder with a tsconfig.json and using paths, and it worked perfectly in VS Code.
so I’m thinking this is a config issue with SST. maybe. let me try a fresh SST proj
f
@Sam Hulick thanks for looking into this. If you get it to reproduce on a fresh SST proj, it’d be great if you could share the repo.
or just zip it up
s
works in a fresh SST proj. shoot. so.. somehow I’ve messed things up
glad it works for other folks though 😄
ok, so I can use the path aliases in files in
src/
but not in
infra/
ahh I see why. duh:
"include": ["src"]
this should work ok, right Frank? as far as any TS-related stuff SST does?
Copy code
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@libs/*": ["src/libs/*"]
    },
    // snip
  },
  // snip
  "include": ["infra", "src"]
}
ahh. yeah.. so that was my mistake.
"lib"
was supposed to be included in there. I renamed mine to
infra
to be clearer, but.. I guess I must’ve removed that from the include list. and hey, now i”m getting type-checking on my infrastructure code now 😄
f
Oh nice! 👍