-
-
Notifications
You must be signed in to change notification settings - Fork 157
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
Superfluous triple-slash directives generated by Glint produce Glint errors (manually removing them fixes this) #564
Comments
@NullVoxPopuli can you confirm that applying the same solution/codefix from ember-cli/ember-page-title#283 would be the proper course of action here? |
Can confirm. Gonna add it to the ts blueprint for v2 addons |
Until the fix has landed and file in the import os
import re
dir_path = './node_modules/ember-concurrency/declarations/helpers'
for file_name in os.listdir(dir_path):
if file_name.endswith('.d.ts'):
file_path = os.path.join(dir_path, file_name)
with open(file_path, 'r') as f:
file_contents = f.read()
file_contents = re.sub('^/// <reference types="[^"]+" />', '', file_contents, flags=re.MULTILINE)
with open(file_path, 'w') as f:
f.write(file_contents) |
Was digging in to this yesterday, and it looks like the generated declarations may slightly be wrong? They're not using |
Should we be using generated declarations at all? Last I knew Edit: ah, I was getting trolled by the |
Any updates on this one? I'm using:
and I'm getting:
|
ember-concurrency has a bug in their types, and they may need to add this inline-rollup plugin: https://github.com/universal-ember/ember-primitives/blob/main/ember-primitives/rollup.config.mjs#L34 {
name: "Build Declarations",
closeBundle: async () => {
/**
* Generate the types (these include /// <reference types="ember-source/types"
* but our consumers may not be using those, or have a new enough ember-source that provides them.
*/
console.log("Building types");
await execaCommand(`pnpm glint --declaration`, { stdio: "inherit" });
/**
* https://github.com/microsoft/TypeScript/issues/56571#
* README: https://github.com/NullVoxPopuli/fix-bad-declaration-output
*/
console.log("Fixing types");
await fixBadDeclarationOutput("declarations/**/*.d.ts", [
["TypeScript#56571", { types: "all" }],
"Glint#628",
"Glint#697",
]);
console.log("⚠️ Dangerously (but neededly) fixed bad declaration output from typescript");
}, I ultimately consider this a bug with TypeScript itself though, because they don't have a story for peer-provided types at all. |
Can confirm that to user ember-concurrency 4.0.2 with a new-enough ember-source (which lacks diff --git a/declarations/helpers/perform.d.ts b/declarations/helpers/perform.d.ts
index 140c903b9428c57f1de4c66e3a4143a77742f5ea..989e429ba29ec126ce603b0cb0f132339094b2ce 100644
--- a/declarations/helpers/perform.d.ts
+++ b/declarations/helpers/perform.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="ember-source/types/preview/@ember/component/helper" />
import type { Task } from '../index';
type PerformParams = [task: Task<any, any[]>, ...args: any[]];
export declare function performHelper(args: PerformParams, hash: any): (...innerArgs: any[]) => any; |
In a fresh 5.6.0 install (
ember new app --typescript
) with just ember-concurrency 4.0.0 and most recent Glint (ember install ember-concurrency
and following the basic instructions from https://typed-ember.gitbook.io/glint/environments/ember/installation), I get these errors when I run Glint on the terminal:There are no
preview
types inember-source
for 5.6.0?Looks like
ember-page-title
has had a similar issue with generated triple-slash directives, see ember-cli/ember-page-title#283I can confirm that manually removing these generated
///
lines fixes this issue for me.The text was updated successfully, but these errors were encountered: