-
Notifications
You must be signed in to change notification settings - Fork 76
Description
Hi
currently the library includes the full list of Italian comuni, but this data is only used internally and is not exported as constants in the type definitions.
This makes it hard (or impossible) to reuse the same data for validation, mapping, or building UI components based on municipalities and provinces.
Example / Expected usage
import { COMUNI, PROVINCE } from "codice-fiscale-js";
// or with types
// import { COMUNI, PROVINCE } from "codice-fiscale-js/types";
Current Behavior
The lists exist internally and are used by the library to compute the codice fiscale.
They cannot be directly imported from the package (neither in JS nor in TypeScript definitions).
Expected Behavior
Export a constant (or module) containing the full list of comuni (e.g., array of objects with name, Belfiore code, province).
Export a constant (or module) containing the list of provinces.
Provide proper TypeScript definitions (comuni, province) to support type-checking and autocomplete.
Why This Matters
Allows developers to reuse official data without duplicating it externally.
Improves TypeScript developer experience (autocomplete, validation, type safety).
Enables easier creation of forms, selectors, validation services, and synchronization with external datasets.
Suggested Solution
Export the data from existing internal files (e.g., src/lista-comuni.ts and src/lista-province.ts).
Add the corresponding type definitions in the .d.ts files.