the_imp·2 anni fa·discussWith Extractors [1] (currently at Stage 1), you could define something like this to work: const Integer = { [Symbol.customMatcher]: (value) => [Number.parseInt(value)] } const Integer(counter) = 42.56; // counter === 42 [1] https://github.com/tc39/proposal-extractors
the_imp·3 anni fa·discussImplementing something like an "id" locale is a great idea. Just don't call it that; it's the locale code for Indonesian.Using a word that's longer than three characters like "identity" will help ensure that it won't conflict with a real locale.