Skip to content

change repos.ts from deployments.json#28

Merged
ryanatkn merged 10 commits intomainfrom
generate-ts
Jul 4, 2024
Merged

change repos.ts from deployments.json#28
ryanatkn merged 10 commits intomainfrom
generate-ts

Conversation

@ryanatkn
Copy link
Copy Markdown
Member

@ryanatkn ryanatkn commented Jul 4, 2024

The TypeScript config "moduleResolution": "NodeNext", is incompatible with the way I was defining JSON types, and searching got me nowhere:

	import deployments from '$lib/deployments.json' assert {type: 'json'};
declare module '$lib/deployments.json' {
	import type {Deployment} from '@ryanatkn/fuz/fetch_deployments.js';
	const data: Deployment[];
	export default data;
}

error: Argument of type 'typeof import("$lib/deployments.json", { with: { "resolution-mode": "import" } })' is not assignable to parameter of type 'Deployment[]'.

I tried multiple compiler options like esModuleInterop and allowSyntheticDefaultImports but no luck, and resolveJsonModule was already enabled, so I'm just going to ditch JSON. If I want performance for huge data I can use the JSON.parse trick.

@ryanatkn ryanatkn merged commit 268abd9 into main Jul 4, 2024
@ryanatkn ryanatkn deleted the generate-ts branch July 4, 2024 15:59
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 this pull request may close these issues.

1 participant