Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow typescript import alias with tsc-alias #21

Closed
Palaxx opened this issue Mar 14, 2024 · 1 comment · Fixed by #22
Closed

Allow typescript import alias with tsc-alias #21

Palaxx opened this issue Mar 14, 2024 · 1 comment · Fixed by #22

Comments

@Palaxx
Copy link
Contributor

Palaxx commented Mar 14, 2024

Hello,

I'm trying to use borp in our codebase which use typescript aliases configured in tsconfig.json, but unlucky alias are not actually supported and the following codes throws this error Error: Cannot find module '@app/add.ts

//src/add.ts
export function add (x: number, y: number): number {
  return x + y
}


//test/add.test.ts
import { test } from 'node:test'
import { add } from '@app/add'
import { strictEqual } from 'node:assert'

test('add', () => {
  strictEqual(add(1, 2), 3)
})
{
  "$schema": "https://json.schemastore.org/tsconfig",
  "compilerOptions": {
    "outDir": "dist",
    "sourceMap": true,
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "esModuleInterop": true,
    "strict": true,
    "resolveJsonModule": true,
    "removeComments": true,
    "newLine": "lf",
    "noUnusedLocals": true,
    "noFallthroughCasesInSwitch": true,
    "isolatedModules": true,
    "forceConsistentCasingInFileNames": true,
    "skipLibCheck": true,
    "lib": [
      "ESNext"
    ],
    "incremental": true,
    "baseUrl": ".",
    "paths": {
      "@app/*": ["src/*"],
      "@test/*": ["test/*"]
    }
  }
}

Can I try to open a PR to introduce a tsc-alias step ?

@mcollina
Copy link
Owner

as long as it's optional and generic enough to allow for more use cases, absolutely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants