Hey HITC TypeScript users... I'm trying to set up ...
# suitescript
e
Hey HITC TypeScript users... I'm trying to set up my environment to start writing suitescript in TS, but I keep getting a "Cannot find module 'N/types'." error.
s
let me dig up a tsconfig.json for you
though I should ask, did you use the
tsconfig.json
that's described in that repo?
it's supposed to work - and if it's become stale I guess it should be updated 🙂
Copy code
json
{
  "compilerOptions": {
    "allowJs": true,
    "strictNullChecks": true,
    "module": "umd",
    "moduleResolution": "node",
    "target": "ES2018",
    "sourceMap": false,
    "newLine": "LF",
    "experimentalDecorators": true,
    "baseUrl": ".",
    "lib":["es2018", "dom"],
    // skip to workaround a lodash.d.ts error TS2428: All declarations of 'WeakMap' must have identical type parameters.
    //"skipLibCheck": true,
    "paths": {
      "N/*": [
        "node_modules/@hitc/netsuite-types/N/*"
      ]
    }
  },
  "exclude":["node_modules",  "__mocks__"]
}
(the above is for SS2.1 target)
Also, you don't call
tsc
on individual files. just run
tsc
without additional arguments from the folder with your
tsconfig.json
(or let your IDE do so on your behalf)
e
I originally used the tsconfig from the repo, and got the error. I now updated to the one you mentioned above but still got the same error
message has been deleted
Does this folder/file structure look correct?
Update - I got this working. For some reason, the N folder in node_modules was empty? I re-ran the npm install --save-dev @hitc/netsuite-types and it showed back up
s
great. Yes if that package wasn't installed correctly it would cause legit errors!