question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Argument types do not match parameters

See original GitHub issue

If I use $t in a script element like this:

<script lang="ts">
	import {t} from '$lib/i18n';

	export let placeholder = $t('search.placeholder');
</script>

PhpStorm shows an error:

Argument types do not match parameters

Placing it inside the template/HTML part …

<input placeholder={$t('search.placeholder')}/>

… does not.

I’m not sure this is a problem with sveltekit-i18n, but I have no idea why this happens. The translation is actually working, it is just the IDE complaining and marking files as erroneous.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
intacommented, Feb 16, 2022

The config looks like:

import i18nKit from 'sveltekit-i18n';

/** @type {import('sveltekit-i18n').Config} */
const translationConfig = {
	loaders: [
		{
			locale: 'en',
			key: '',
			loader: async () => (
				await import('../../translations/en.json')
			).default,
		},
		{
			locale: 'de',
			key: '',
			loader: async () => (
				await import('../../translations/de.json')
			).default,
		},
	],
};

export const {t, locale, locales, loading, loadTranslations} = new i18nKit(translationConfig);

for now (separation into modules is planned, but not done yet).

In __layout.svelte I just call:

await loadTranslations(language, pathname);
locale.set(language);

inside the load function.

Version: 2.0.0-rc.6

0reactions
jarda-svobodacommented, Feb 17, 2022

Well, the weird thing is, that it worked in regular .ts…🤔

Read more comments on GitHub >

github_iconTop Results From Across the Web

express app.get function gives "Argument types do not match ...
When I remove the @types/express package, WebStorm no longer gives the error message, but the TypeScript compiler gives a error TS2307: Cannot ...
Read more >
Incorrect TypeScript "Argument types do not match parameters"
The ({}) in the last line has a squiggly red underline and shows the error "Argument types do not match parameters". However the...
Read more >
Why Do the Input Argument Types Not Match When I Invoke a ...
If you invoke a method and you get an error that says that the input argument types do not match, the method that...
Read more >
Arguments types do not match parameter warning in tutorial ...
I don't think this is a problem with the tutorial. It seems to be an issue with the Typescript compiler in Webstorm/PHPstorm.
Read more >
Argument does not match forward declaration
Change the data type of the indicated parameter in the declaration or the definition of the procedure so that they match. The data...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found