Typescript with customModule

Is anyone using Typescript to compile their custom modules? I'm just curious if there are any OSC types files roaming about as I'm not too experienced in creating type files.

Creating types for most of it seems okay, but using NativeRequire for a type is where the compiler for me was screwing up since it compiles NativeRequire just to require ("") which won't work for node modules in OSC.

Cheers,
DMDComposer

I've managed to build a few global types, however, my issue wasn't with correct typecasting but I believe with how OSC is compiling the custom module. I think OSC won't allow the compiled TSC to run.

've tried a simple typescript custom module with an import TSC. In the tsconfig.json, I've tried using module "CommonJS" or any other one practically. I get either one of these errors from OSC console.log
SyntaxError: Cannot use import statement outside a module
or
ReferenceError: exports is not defined

Is there a different way to go about this to enable Typescript compiling with custom modules in OSC? Or, is it simply not possible yet with the current state of OSC?

Cheers,
DMDComposer

// testMain.ts
import testImport from "./testImport.js"
console.log(testImport)
//testImport.ts
export default {
  testImport: "hello",
}
// tsconfig.json
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      ".": ["."]
    },
    "outDir": "./compiled" /* Redirect output structure to the directory. */,
    "rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
    "module": "CommonJS",
    "moduleResolution": "Node",
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": false,
    "target": "ES6",
    "checkJs": true,
    "lib": ["ES6"],
    "skipLibCheck": true,
    "noImplicitThis": false,
    "forceConsistentCasingInFileNames": true
  },
  "include": ["./**/*.ts"],
  "exclude": ["node_modules"]
}