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

use types shipped by ember-source #1423

Merged

Conversation

jelhan
Copy link
Contributor

@jelhan jelhan commented Feb 17, 2024

The types generated using DefinetlyTyped are incompatible with types shipped by ember-source:

[lint:types] node_modules/ember-math-helpers/declarations/helpers/sub.d.ts:21:50 - error TS2694: Namespace '"@ember/component/helper"' has no exported member 'EmptyObject'.
[lint:types] 
[lint:types] 21         Named: import("@ember/component/helper").EmptyObject;
[lint:types]                                                     ~~~~~~~~~~~

Types generated by this PR:

/// <reference types="ember-source/types/stable/@ember/-internals/glimmer/lib/helper" />
/// <reference types="ember-source/types/stable/@ember/component/helper" />
export interface SubSignature {
    Args: {
        Positional: Array<number>;
    };
    Return: number;
}
/**
 * Subtracts two or more numbers
 *
 * ```hbs
 * {{sub a b}}
 * ```
 *
 * @param numbers A list of numbers to subtract
 * @return The difference of all the passed numbers
 */
export declare function sub(numbers: Array<number>): number;
declare const _default: import("@ember/component/helper").FunctionBasedHelper<SubSignature>;
export default _default;
//# sourceMappingURL=sub.d.ts.map

Types generated by latest main branch:

export interface SubSignature {
    Args: {
        Positional: Array<number>;
    };
    Return: number;
}
/**
 * Subtracts two or more numbers
 *
 * ```hbs
 * {{sub a b}}
 * ```
 *
 * @param numbers A list of numbers to subtract
 * @return The difference of all the passed numbers
 */
export declare function sub(numbers: Array<number>): number;
declare const _default: import("@ember/component/helper").FunctionBasedHelper<{
    Args: {
        Positional: number[];
        Named: import("@ember/component/helper").EmptyObject;
    };
    Return: number;
}>;
export default _default;
//# sourceMappingURL=sub.d.ts.map

I'm not sure if the two lines at the top of the generated types starting with three slashes (///) could cause any harm. Especially if they break incompatibility with consumers using typed from DefinetlyTyped. I'm not a TypeScript expert and honestly just not being sure what that reference is about at all.

Closes #1220

@RobbieTheWagner
Copy link
Owner

@jelhan thanks for the PR! It looks like the pnpm lockfile is outdated. Can you please make sure that is updated?

@jelhan
Copy link
Contributor Author

jelhan commented Feb 17, 2024

@jelhan thanks for the PR! It looks like the pnpm lockfile is outdated. Can you please make sure that is updated?

Done. Not sure why it wasn't committed in the first time.

@RobbieTheWagner RobbieTheWagner force-pushed the use-types-shipped-by-ember-source branch from 2f3fd62 to 44eb9fd Compare April 4, 2024 14:31
@RobbieTheWagner
Copy link
Owner

@jelhan I rebased this and it seems to be failing now. Any ideas?

@jelhan
Copy link
Contributor Author

jelhan commented Apr 4, 2024

@jelhan I rebased this and it seems to be failing now. Any ideas?

Seems to be an upstream issue in types of Glimmer package. Likely very recently introduced.

@jelhan
Copy link
Contributor Author

jelhan commented Apr 4, 2024

I created this upstream issue: glimmerjs/glimmer-vm#1586

@jelhan
Copy link
Contributor Author

jelhan commented Apr 4, 2024

@RobbieTheWagner: I think I fixed it with support of @NullVoxPopuli. Please approve the workflow to see if it is actually passing in CI as well.

@RobbieTheWagner RobbieTheWagner merged commit 8e419ed into RobbieTheWagner:main Apr 6, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Namespace '"@ember/component/helper"' has no exported member 'EmptyObject'.
2 participants