Skip to content

minimumFractionDigits generated code triggers svelte-check type checking #625

@lucas-subli

Description

@lucas-subli

This works:

"formatted_percentage": [
		{
			"declarations": ["input value", "local formattedValue = value: number"],
			"match": {
				"value=*": "{formattedValue}%"
			}
		}
	],

This

"formatted_percentage": [
		{
			"declarations": [
				"input value",
				"local formattedValue = value: number minimumFractionDigits=1 maximumFractionDigits=1"
			],
			"match": {
				"value=*": "{formattedValue}%"
			}
		}
	],

Makes svelte-check annoyed:

src/lib/paraglide/messages/en-us.js:513:62
Error: Type 'string' is not assignable to type 'number'. 
export const formatted_percentage = /** @type {(inputs: Formatted_PercentageInputs) => LocalizedString} */ (i) => {
	const formattedValue = registry.number("en-us", i?.value, { minimumFractionDigits: "1", maximumFractionDigits: "1" });return /** @type {LocalizedString} */ (`${formattedValue}%`)
};
Image

To work around it I had to change checkJs to false on tsconfig.json.
Adding the folder to the tsconfig excludes did not work as it is a direct dependency and svelte will always check direct dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions