Skip to content

Conversation

@k-yle
Copy link
Collaborator

@k-yle k-yle commented Dec 26, 2024

Besides from iD, there are several typescript projects which use this library. Currently, each project has to write their own type-definitions (see examples from overpass-turbo and osmapp). This is inconvenient and the definitions could easily become out-of-date.

This PR uses json-schema-to-typescript to generate TS definition files for the main JSON files in dist/*. This means that the next release of @openstreetmap/id-tagging-schema will include .d.json.ts files - example here

Examples:

import fields from "id-tagging-schema/dist/fields.json";
fields // type-definitions are available for fields

// and definitions can be imported by name, like `Field` or `Preset`
import type { /* ... */ } from "id-tagging-schema";

Copy link
Collaborator

@tordans tordans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. I really like to see more TS in our projects. It will make working with them a lot easier.

@tyrasd tyrasd self-requested a review July 1, 2025 09:39
Copy link
Collaborator

@tyrasd tyrasd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be preferable if we could keep the no-await-in-loop linter rule. If the specific use here makes the file more easily readable, it's better to only disable the rule on that particular occurrence.

PS: for the types definitions to be imported as

import type { Field } from '@openstreetmap/id-tagging-schema';

we'd need to include "types": "./dist/index.d.ts" in package.json, right?

@k-yle
Copy link
Collaborator Author

k-yle commented Oct 24, 2025

done, also added ignoreMinAndMaxItems due to #242

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.

4 participants