Open ijlee2 opened 1 year ago
:+1:
We are currently experiencing a similar issue when moving from rollup-plugin-ts to the recent embroider blueprint changes.
The build:types
script just silently completes but no declarations folder is created, but the start:types
script does work.
This issue is affecting our addons too - we've resorted to disabling glint typechecking for all hbs files to restore declaration generation from ts files:
// in tsconfig.json
"exclude": ["src/**/*.hbs"],
same for {{! @glint-expect-error }}
We got hit by this too, because of a {{! @glint-expect-error }}
just like @basz
1- is it possible to update this ticket's name to add a ref to {{! @glint-expect-error }}
?
2- Any guidance on how to start a PR to address this issue?
This is probably not trivial for a new contributor to fix (I’m not totally sure what the solution will look like at this point), but I expect that setting noEmitOnError: false
should be a viable workaround in the meantime.
@bartocc I updated the title based on your suggestion.
@dfreeman Several issues were reported since this one, so I think it may be hard for people who are new to Glint to discover this issue. Could we pin this issue so that it appears on top of the page for https://github.com/typed-ember/glint/issues?
Background
To move
@embroider/addon-blueprint
away fromrollup-plugin-ts
, we changed how declaration files are created (it is assumed that the v2 addon runs onglint
).When I tried the new approach on
ember-container-query
, I noticed that,build:types
doesn't create thedeclarations
folderstart:types
does create thedeclarations
folderI filed a bug report in https://github.com/embroider-build/addon-blueprint/issues/139.
@NullVoxPopuli and @dfreeman, who further investigated the problem, found the cause to be a
@glint-ignore
comment that I had added some time ago.Dan on Discord
> it looks like a bug > > specifically, if I set `noEmitOnError: false`, declarations are emitted > > I'm guessing it happens to work with `--build` because that will always emit declarations, regardless of errors (because `--build` prioritizes having declarations available for your other project references) > > ah > > it's because of the `@glint-ignore` here > https://github.com/ijlee2/ember-container-query/blob/4.0.4/ember-container-query/src/components/container-query.hbs#L1 > > the bug appears to be that TS internally is counting that as an error that triggers `noEmitOnError` behavior > > if I add an entry for `element` in the registry in `unpublished-development-types`, everything worksAdditional notes
By adding
console.log()
's, I checked thatglint --declaration
results indetermineOptionsToExtend()
correctly settingoptions.{noEmit,declaration,emitDeclarationOnly}
(tofalse
,true
, andtrue
, respectively).I'm guessing that something different happens,
glint --build
as opposed toglint --declaration
glint --declaration --watch
as opposed to justglint --declaration