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

Incompatible with native ember-source types #1802

Closed
bertdeblock opened this issue Nov 20, 2023 · 5 comments · Fixed by #1825
Closed

Incompatible with native ember-source types #1802

bertdeblock opened this issue Nov 20, 2023 · 5 comments · Fixed by #1825

Comments

@bertdeblock
Copy link
Contributor

bertdeblock commented Nov 20, 2023

ember-intl is trying to import SafeString from @ember/template/-private/handlebars, which doesn't exist without having the @types/ember__template package installed.

It also tries to import EmberRunTimer from @ember/runloop/types which fails as well.

@bertdeblock bertdeblock changed the title Incompatible with native @ember/template types Incompatible with native ember-source types Nov 20, 2023
@jelhan
Copy link
Contributor

jelhan commented Dec 12, 2023

I can still reproduce the issue with Ember Intl v6.4.0, which is the latest version today.

I'm seeing the following errors:

 [lint:types] node_modules/ember-intl/-private/formatters/-base.d.ts:1:33 - error TS2307: Cannot find module '@ember/template/-private/handlebars' or its corresponding type declarations.
[lint:types] 
[lint:types] 1 import type { SafeString } from '@ember/template/-private/handlebars';
[lint:types]                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[lint:types] 
[lint:types] node_modules/ember-intl/-private/formatters/format-message.d.ts:1:33 - error TS2307: Cannot find module '@ember/template/-private/handlebars' or its corresponding type declarations.
[lint:types] 
[lint:types] 1 import type { SafeString } from '@ember/template/-private/handlebars';
[lint:types]                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[lint:types] 
[lint:types] node_modules/ember-intl/services/intl.d.ts:1:36 - error TS2307: Cannot find module '@ember/runloop/types' or its corresponding type declarations.
[lint:types] 
[lint:types] 1 import type { EmberRunTimer } from '@ember/runloop/types';
[lint:types]                                      ~~~~~~~~~~~~~~~~~~~~~~
[lint:types] 
[lint:types] node_modules/ember-intl/services/intl.d.ts:3:33 - error TS2307: Cannot find module '@ember/template/-private/handlebars' or its corresponding type declarations.
[lint:types] 
[lint:types] 3 import type { SafeString } from '@ember/template/-private/handlebars';
[lint:types]                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Please find a reproduction here: https://github.com/jelhan/test-ember-intl-with-ember-native-types

@ijlee2
Copy link
Contributor

ijlee2 commented Dec 12, 2023

@jelhan Thanks for checking the latest version and providing a demo app.

Between 6.3.2 and 6.4.0, I didn't update the intl service and the private files in -private/formatters, so I think it's expected that we continue to see type errors.

@jelhan
Copy link
Contributor

jelhan commented Dec 12, 2023

I can fix the issue by patching Ember Intl's types locally as the following:

- import type { SafeString } from '@ember/template/-private/handlebars';
+ import type { SafeString } from '@ember/template';
- import type { EmberRunTimer } from '@ember/runloop/types';
+ import type { Timer as EmberRunTimer } from '@ember/runloop';

Not sure if those changes would work with types from @types/ember* as well.

@ijlee2
Copy link
Contributor

ijlee2 commented Dec 12, 2023

I can fix the issue by patching Ember Intl's types locally as the following:

Nice! Can you create a pull request to test the change in this repo? The CI, which lints the files in ember-intl and test-app directories, will help us check. (You can also run pnpm lint locally, either at the workspace root, or at the root of a package.)

@jelhan
Copy link
Contributor

jelhan commented Dec 12, 2023

Can you create a pull request to test the change in this repo? The CI, which lints the files in ember-intl and test-app directories, will help us check.

Please find the PR here: #1825

Sadly, the changes do not work with types published from @types/ember*. 😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants