GithubHelp home page GithubHelp logo

Comments (8)

ijlee2 avatar ijlee2 commented on June 4, 2024 2

"BaseHelper"-errors, such as those seen in #1787 (comment), should be fixed in v6.3.1. Please give it a try. 🤞🏼

from ember-intl.

ijlee2 avatar ijlee2 commented on June 4, 2024 1

Thanks for creating the issue and documenting your findings. I received a similar report in #1764 and could reproduce the TS issue locally.

I won't be able to work on a fix this week due to EmberFest. At the moment, my gut feeling is, the work may not be trivial, because ember-intl will need to support TypeScript (TS configuration extends @tsconfig/ember) and Glint (run on the latest version) better in v6.

For now, let me suggest to you and other end-developers to use skipLibCheck: true, or patch ember-intl with @ts-ignore or @ts-expect-error as needed.

from ember-intl.

ijlee2 avatar ijlee2 commented on June 4, 2024

Update:

Here are the errors that I got in ember-workshop, after installing [email protected] and removing "skipLibCheck": true in my-app/tsconfig.json.

Output from pnpm lint:types
../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/-format-base.d.ts:17:21 - error TS2314: Generic type 'BaseHelperSignature<Value, Options>' requires 2 type argument(s).

17   Signature extends BaseHelperSignature,
                       ~~~~~~~~~~~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/-format-base.d.ts:27:3 - error TS2416: Property 'compute' in type 'AbstractHelper<Signature>' is not assignable to the same property in base type 'Helper<Signature>'.
  Type '{ (positional: [undefined], namedOptions: Signature["Args"]["Named"] & { allowEmpty: false; }): never; (positional: [undefined], namedOptions: Signature["Args"]["Named"] & { ...; }): void; (positional: Signature["Args"]["Positional"], namedOptions: Signature["Args"]["Named"]): string; }' is not assignable to type '(positional: GetOr<GetOr<Signature, "Args", {}>, "Positional", DefaultPositional>, named: GetOr<GetOr<Signature, "Args", {}>, "Named", object>) => GetOr<...>'.
    Types of parameters 'positional' and 'positional' are incompatible.
      Type 'GetOr<GetOr<Signature, "Args", {}>, "Positional", DefaultPositional>' is not assignable to type '[undefined]'.
        Type 'DefaultPositional | GetOr<Signature, "Args", {}>[keyof GetOr<Signature, "Args", {}> & "Positional"]' is not assignable to type '[undefined]'.
          Type 'DefaultPositional' is not assignable to type '[undefined]'.
            Target requires 1 element(s) but source may have fewer.

27   compute(
     ~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/-format-base.d.ts:31:3 - error TS2416: Property 'compute' in type 'AbstractHelper<Signature>' is not assignable to the same property in base type 'Helper<Signature>'.
  Type '{ (positional: [undefined], namedOptions: Signature["Args"]["Named"] & { allowEmpty: false; }): never; (positional: [undefined], namedOptions: Signature["Args"]["Named"] & { ...; }): void; (positional: Signature["Args"]["Positional"], namedOptions: Signature["Args"]["Named"]): string; }' is not assignable to type '(positional: GetOr<GetOr<Signature, "Args", {}>, "Positional", DefaultPositional>, named: GetOr<GetOr<Signature, "Args", {}>, "Named", object>) => GetOr<...>'.

31   compute(
     ~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/-format-base.d.ts:35:3 - error TS2416: Property 'compute' in type 'AbstractHelper<Signature>' is not assignable to the same property in base type 'Helper<Signature>'.
  Type '{ (positional: [undefined], namedOptions: Signature["Args"]["Named"] & { allowEmpty: false; }): never; (positional: [undefined], namedOptions: Signature["Args"]["Named"] & { ...; }): void; (positional: Signature["Args"]["Positional"], namedOptions: Signature["Args"]["Named"]): string; }' is not assignable to type '(positional: GetOr<GetOr<Signature, "Args", {}>, "Positional", DefaultPositional>, named: GetOr<GetOr<Signature, "Args", {}>, "Named", object>) => GetOr<...>'.

35   compute(
     ~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/format-date.d.ts:7:34 - error TS2344: Type '(Omit<DateTimeFormatOptions, "localeMatcher"> & CustomFormatConfig<"date"> & { locale?: string | [string, ...string[]] | undefined; }) | undefined' does not satisfy the constraint 'Record<string, unknown>'.
  Type 'undefined' is not assignable to type 'Record<string, unknown>'.

7   BaseHelperSignature<Params[0], Params[1]>
                                   ~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/format-list.d.ts:7:34 - error TS2344: Type '(FormatListOptions & { locale?: string | [string, ...string[]] | undefined; }) | undefined' does not satisfy the constraint 'Record<string, unknown>'.
  Type 'undefined' is not assignable to type 'Record<string, unknown>'.

7   BaseHelperSignature<Params[0], Params[1]>
                                   ~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/format-message.d.ts:7:34 - error TS2344: Type '(Partial<Record<string, unknown>> & { htmlSafe?: boolean | undefined; locale?: string | [string, ...string[]] | undefined; }) | undefined' does not satisfy the constraint 'Record<string, unknown>'.
  Type 'undefined' is not assignable to type 'Record<string, unknown>'.

7   BaseHelperSignature<Params[0], Params[1]>
                                   ~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/format-number.d.ts:7:34 - error TS2344: Type '(Omit<NumberFormatOptions, "localeMatcher"> & CustomFormatConfig<"number"> & { locale?: string | [string, ...string[]] | undefined; }) | undefined' does not satisfy the constraint 'Record<string, unknown>'.
  Type 'undefined' is not assignable to type 'Record<string, unknown>'.

7   BaseHelperSignature<Params[0], Params[1]>
                                   ~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/format-relative.d.ts:7:34 - error TS2344: Type '(Omit<RelativeTimeFormatOptions, "localeMatcher"> & CustomFormatConfig<"time"> & { unit?: RelativeTimeFormatUnit | undefined; } & { ...; }) | undefined' does not satisfy the constraint 'Record<string, unknown>'.
  Type 'undefined' is not assignable to type 'Record<string, unknown>'.

7   BaseHelperSignature<Params[0], Params[1]>
                                   ~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/format-time.d.ts:7:34 - error TS2344: Type '(Omit<DateTimeFormatOptions, "localeMatcher"> & CustomFormatConfig<"date"> & { locale?: string | [string, ...string[]] | undefined; }) | undefined' does not satisfy the constraint 'Record<string, unknown>'.
  Type 'undefined' is not assignable to type 'Record<string, unknown>'.

7   BaseHelperSignature<Params[0], Params[1]>
                                   ~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/t.d.ts:7:34 - error TS2344: Type 'TOptions | undefined' does not satisfy the constraint 'Record<string, unknown>'.
  Type 'undefined' is not assignable to type 'Record<string, unknown>'.

7   BaseHelperSignature<Params[0], Params[1]>
                                   ~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/macros/intl.d.ts:9:57 - error TS2315: Type 'ComputedProperty' is not generic.

9 export default function intl<T>(getterFn: GetterFn<T>): ComputedProperty<T>;
                                                          ~~~~~~~~~~~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/macros/intl.d.ts:10:71 - error TS2315: Type 'ComputedProperty' is not generic.

10 export default function intl<T>(key0: string, getterFn: GetterFn<T>): ComputedProperty<T>;
                                                                         ~~~~~~~~~~~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/macros/intl.d.ts:11:85 - error TS2315: Type 'ComputedProperty' is not generic.

11 export default function intl<T>(key0: string, key1: string, getterFn: GetterFn<T>): ComputedProperty<T>;
                                                                                       ~~~~~~~~~~~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/macros/intl.d.ts:12:99 - error TS2315: Type 'ComputedProperty' is not generic.

12 export default function intl<T>(key0: string, key1: string, key2: string, getterFn: GetterFn<T>): ComputedProperty<T>;
                                                                                                     ~~~~~~~~~~~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/macros/intl.d.ts:13:113 - error TS2315: Type 'ComputedProperty' is not generic.

13 export default function intl<T>(key0: string, key1: string, key2: string, key3: string, getterFn: GetterFn<T>): ComputedProperty<T>;
                                                                                                                   ~~~~~~~~~~~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/macros/intl.d.ts:14:127 - error TS2315: Type 'ComputedProperty' is not generic.

14 export default function intl<T>(key0: string, key1: string, key2: string, key3: string, key4: string, getterFn: GetterFn<T>): ComputedProperty<T>;
                                                                                                                                 ~~~~~~~~~~~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/macros/intl.d.ts:15:141 - error TS2315: Type 'ComputedProperty' is not generic.

15 export default function intl<T>(key0: string, key1: string, key2: string, key3: string, key4: string, key5: string, getterFn: GetterFn<T>): ComputedProperty<T>;
                                                                                                                                               ~~~~~~~~~~~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/macros/intl.d.ts:16:155 - error TS2315: Type 'ComputedProperty' is not generic.

16 export default function intl<T>(key0: string, key1: string, key2: string, key3: string, key4: string, key5: string, key6: string, getterFn: GetterFn<T>): ComputedProperty<T>;
                                                                                                                                                             ~~~~~~~~~~~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/macros/intl.d.ts:17:169 - error TS2315: Type 'ComputedProperty' is not generic.

17 export default function intl<T>(key0: string, key1: string, key2: string, key3: string, key4: string, key5: string, key6: string, key7: string, getterFn: GetterFn<T>): ComputedProperty<T>;
                                                                                                                                                                           ~~~~~~~~~~~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/macros/intl.d.ts:18:183 - error TS2315: Type 'ComputedProperty' is not generic.

18 export default function intl<T>(key0: string, key1: string, key2: string, key3: string, key4: string, key5: string, key6: string, key7: string, key8: string, getterFn: GetterFn<T>): ComputedProperty<T>;
                                                                                                                                                                                         ~~~~~~~~~~~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/macros/intl.d.ts:19:197 - error TS2315: Type 'ComputedProperty' is not generic.

19 export default function intl<T>(key0: string, key1: string, key2: string, key3: string, key4: string, key5: string, key6: string, key7: string, key8: string, key9: string, getterFn: GetterFn<T>): ComputedProperty<T>;
                                                                                                                                                                                                       ~~~~~~~~~~~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/macros/intl.d.ts:20:209 - error TS2315: Type 'ComputedProperty' is not generic.

20 export default function intl<T>(key0: string, key1: string, key2: string, key3: string, key4: string, key5: string, key6: string, key7: string, key8: string, key9: string, ...rest: [string | GetterFn<T>][]): ComputedProperty<T>;
                                                                                                                                                                                                                   ~~~~~~~~~~~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/macros/t.d.ts:28:107 - error TS2315: Type 'ComputedProperty' is not generic.

28 export default function createTranslatedComputedProperty(translationKey: string, options?: MacroOptions): ComputedProperty<ReturnType<IntlService['t']>>;
                                                                                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

from ember-intl.

jelhan avatar jelhan commented on June 4, 2024

I run into the issue that IntlService is declared twice when importing setupIntl in an integration test. I think the IntlService types should be imported from ember-intl/services/intl instead of ember-intl in addon-test-support/setup-intl.ts.

import type { IntlService } from 'ember-intl';

from ember-intl.

IgnaceMaes avatar IgnaceMaes commented on June 4, 2024

No new details to add, but confirming I'm also seeing this error posted above:

../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/-format-base.d.ts:17:21 - error TS2314: Generic type 'BaseHelperSignature<Value, Options>' requires 2 type argument(s).

17   Signature extends BaseHelperSignature,
                       ~~~~~~~~~~~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/-format-base.d.ts:27:3 - error TS2416: Property 'compute' in type 'AbstractHelper<Signature>' is not assignable to the same property in base type 'Helper<Signature>'.
  Type '{ (positional: [undefined], namedOptions: Signature["Args"]["Named"] & { allowEmpty: false; }): never; (positional: [undefined], namedOptions: Signature["Args"]["Named"] & { ...; }): void; (positional: Signature["Args"]["Positional"], namedOptions: Signature["Args"]["Named"]): string; }' is not assignable to type '(positional: PositionalArgs<Signature>, named: NamedArgs<Signature>) => GetOrElse<Signature, "Return", unknown>'.
    Types of parameters 'positional' and 'positional' are incompatible.
      Type 'PositionalArgs<Signature>' is not assignable to type '[undefined]'.
        Type 'Signature[] | (unknown extends Signature ? MissingSignatureArgs : keyof Signature extends "Args" | "Return" ? ArgsFor<Signature> : LegacyArgsFor<...>)["Positional"]' is not assignable to type '[undefined]'.
          Type 'Signature[]' is not assignable to type '[undefined]'.
            Target requires 1 element(s) but source may have fewer.

27   compute(
     ~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/-format-base.d.ts:31:3 - error TS2416: Property 'compute' in type 'AbstractHelper<Signature>' is not assignable to the same property in base type 'Helper<Signature>'.
  Type '{ (positional: [undefined], namedOptions: Signature["Args"]["Named"] & { allowEmpty: false; }): never; (positional: [undefined], namedOptions: Signature["Args"]["Named"] & { ...; }): void; (positional: Signature["Args"]["Positional"], namedOptions: Signature["Args"]["Named"]): string; }' is not assignable to type '(positional: PositionalArgs<Signature>, named: NamedArgs<Signature>) => GetOrElse<Signature, "Return", unknown>'.

31   compute(
     ~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/-format-base.d.ts:35:3 - error TS2416: Property 'compute' in type 'AbstractHelper<Signature>' is not assignable to the same property in base type 'Helper<Signature>'.
  Type '{ (positional: [undefined], namedOptions: Signature["Args"]["Named"] & { allowEmpty: false; }): never; (positional: [undefined], namedOptions: Signature["Args"]["Named"] & { ...; }): void; (positional: Signature["Args"]["Positional"], namedOptions: Signature["Args"]["Named"]): string; }' is not assignable to type '(positional: PositionalArgs<Signature>, named: NamedArgs<Signature>) => GetOrElse<Signature, "Return", unknown>'.

35   compute(
     ~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/format-date.d.ts:7:34 - error TS2344: Type '(Omit<DateTimeFormatOptions, "localeMatcher"> & CustomFormatConfig<"date"> & { locale?: string | [string, ...string[]] | undefined; }) | undefined' does not satisfy the constraint 'Record<string, unknown>'.
  Type 'undefined' is not assignable to type 'Record<string, unknown>'.

7   BaseHelperSignature<Params[0], Params[1]>
                                   ~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/format-list.d.ts:7:34 - error TS2344: Type '(FormatListOptions & { locale?: string | [string, ...string[]] | undefined; }) | undefined' does not satisfy the constraint 'Record<string, unknown>'.
  Type 'undefined' is not assignable to type 'Record<string, unknown>'.

7   BaseHelperSignature<Params[0], Params[1]>
                                   ~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/format-message.d.ts:7:34 - error TS2344: Type '(Partial<Record<string, unknown>> & { htmlSafe?: boolean | undefined; locale?: string | [string, ...string[]] | undefined; }) | undefined' does not satisfy the constraint 'Record<string, unknown>'.
  Type 'undefined' is not assignable to type 'Record<string, unknown>'.

7   BaseHelperSignature<Params[0], Params[1]>
                                   ~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/format-number.d.ts:7:34 - error TS2344: Type '(Omit<NumberFormatOptions, "localeMatcher"> & CustomFormatConfig<"number"> & { locale?: string | [string, ...string[]] | undefined; }) | undefined' does not satisfy the constraint 'Record<string, unknown>'.
  Type 'undefined' is not assignable to type 'Record<string, unknown>'.

7   BaseHelperSignature<Params[0], Params[1]>
                                   ~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/format-relative.d.ts:7:34 - error TS2344: Type '(Omit<RelativeTimeFormatOptions, "localeMatcher"> & CustomFormatConfig<"time"> & { unit?: RelativeTimeFormatUnit | undefined; } & { ...; }) | undefined' does not satisfy the constraint 'Record<string, unknown>'.
  Type 'undefined' is not assignable to type 'Record<string, unknown>'.

7   BaseHelperSignature<Params[0], Params[1]>
                                   ~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/format-time.d.ts:7:34 - error TS2344: Type '(Omit<DateTimeFormatOptions, "localeMatcher"> & CustomFormatConfig<"date"> & { locale?: string | [string, ...string[]] | undefined; }) | undefined' does not satisfy the constraint 'Record<string, unknown>'.
  Type 'undefined' is not assignable to type 'Record<string, unknown>'.

7   BaseHelperSignature<Params[0], Params[1]>
                                   ~~~~~~~~~

../node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/ember-intl/helpers/t.d.ts:7:34 - error TS2344: Type 'TOptions | undefined' does not satisfy the constraint 'Record<string, unknown>'.
  Type 'undefined' is not assignable to type 'Record<string, unknown>'.

7   BaseHelperSignature<Params[0], Params[1]>

On:

from ember-intl.

IgnaceMaes avatar IgnaceMaes commented on June 4, 2024

Can confirm that updating to v6.3.1 resolved the BaseHelper Glint errors for me. Thank you so much for the fix!

I did notice the following change in behaviour as well: #1813

from ember-intl.

chrisvdp avatar chrisvdp commented on June 4, 2024

We upgraded to 6.4.0 and are seeing this resolved. Thanks 🥳

from ember-intl.

ijlee2 avatar ijlee2 commented on June 4, 2024

@chrisvdp Thanks for the update!

from ember-intl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.