typed-ember / glint

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

glint cli does not produce declaration-related errors where tsc cli does #536

Open bendemboski opened 1 year ago

bendemboski commented 1 year ago

Repro

  1. mkdir glint-test && cd glint-test
  2. yarn init -y
  3. yarn add --dev typescript @glint/core @glint/template @glint/environment-ember-loose (same behavior if you install the 1.0 beta)
  4. Create a tsconfig.json that looks like:
    {
    "compilerOptions": {
    "declaration": true,
    },
    "glint": {
    "environment": "ember-loose"
    }
    }
  5. Create a foo.ts that looks like:
    
    class Foo {
    protected prop = 1;
    }

export default function makeBar() { class Bar extends Foo {} return new Bar(); }


10. Run `yarn tsc` and `yarn glint`

## Expected

`yarn glint` produces the same errors as `yarn tsc`

## Actual

`yarn tsc` errors with `foo.ts:5:25 - error TS4094: Property 'prop' of exported class expression may not be private or protected` while `yarn glint` produces no errors.

## Discussion

I'm not 100% sure this is an issue that GLint should address, but it seems worth raising. We _could_ choose to assert that `glint` should always produce a superset of the errors that `tsc` produces, i.e. it produces all the same errors for typescript, plus additional errors for templates. If so, then it's failing to do so in this case.

I kind of think that the line at the GLint overview documentation that states that `Glint's CLI provides a template-aware tool for performing end-to-end TypeScript typechecking on your project` implies that we should be/are making this assertion, but I also recognize that this is a bit of an edge case.