typed-ember / glint

TypeScript powered tooling for Glimmer templates
https://typed-ember.gitbook.io/glint
MIT License
109 stars 51 forks source link

compat: `gts` files don't respect references and include from `tsconfig` #712

Open runspired opened 6 months ago

runspired commented 6 months ago

Example tsconfig from a monorepo project (EmberData in this case)

{
  "include": ["src/**/*", "../../@types/fastboot", "../../@types/@glimmer/tracking.d.ts"],
  "glint": {
    "environment": ["ember-loose", "ember-template-imports"]
  },
  "compilerOptions": {
    "target": "ESNext",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "skipLibCheck": true,
    "declarationDir": "unstable-preview-types",
    "emitDeclarationOnly": true,
    "noEmit": false,
    "allowJs": false,
    "checkJs": false,
    "alwaysStrict": true,
    "strict": true,
    "allowSyntheticDefaultImports": true,

    "noImplicitAny": true,
    "noImplicitThis": true,
    "strictBindCallApply": true,
    "strictFunctionTypes": true,
    "strictPropertyInitialization": true,
    "allowUnreachableCode": false,
    "allowUnusedLabels": false,
    "noEmitOnError": false,
    "strictNullChecks": true,
    "noErrorTruncation": true,
    "preserveConstEnums": false,
    "experimentalDecorators": true,
    "pretty": true,

    // Enable faster builds
    // but causes us to not rebuild properly
    "composite": true,
    "incremental": true,
    "rootDir": "src",

    "declaration": true,
    "declarationMap": true,
    "inlineSourceMap": true,
    "inlineSources": true,

    "baseUrl": "src",

    "paths": {
      "@ember-data/env": ["../../private-build-infra/virtual-packages/env.d.ts"]
    },

    "types": ["ember-source/types"]
  },
  "references": [{ "path": "../store" }, { "path": "../core-types" }, { "path": "../request" }]
}

ts files will properly resolve ember types and references paths, gts files will not.

image

My naive suspicion is that glint is generating a unique tsconfig for gts files that needs to copy forward these options and doesn't currently.