Releases: seek-oss/vocab
@vocab/[email protected]
Patch Changes
b39462c
#124 Thanks @jahredhope! - Display the remaining seconds in the rate limit relative to now.
@vocab/[email protected]
Minor Changes
-
fa1d81f
#121 Thanks @askoufis! - AddStringWithSuggestions
utility typeThis type is equivalent to the
string
type, but it tricks the language server into providing suggestions for string literals passed into theSuggestions
generic parameter.EXAMPLE USAGE:
type AnyAnimal = StringWithSuggestions<'cat' | 'dog'>; // Suggests cat and dog, but accepts any string const animal: AnyAnimal = '';
@vocab/[email protected]
Patch Changes
-
fa1d81f
#121 Thanks @askoufis! - AddStringWithSuggestions
utility typeThis type is equivalent to the
string
type, but it tricks the language server into providing suggestions for string literals passed into theSuggestions
generic parameter.EXAMPLE USAGE:
type AnyAnimal = StringWithSuggestions<'cat' | 'dog'>; // Suggests cat and dog, but accepts any string const animal: AnyAnimal = '';
-
Updated dependencies [
fa1d81f
]:- @vocab/[email protected]
@vocab/[email protected]
Patch Changes
-
ec718fe
#119 Thanks @askoufis! - Fix compiled type forselect
parameterVocab uses
intl-messageformat
to parse and derive types for ICU translation messages.
By default this parser enforces thatselect
(andplural
) arguments must contain another
clause as a fallthrough.
Vocab does not deviate from this default, but it was previously deriving the type of select type arguments as a string literal union of all possible match cases:{ "My message": { "message": "{param, select, foo {foo} bar {bar} other {baz}}" } }
// Type Error: `param` is not of type 'foo' | 'bar' | 'other' t('My message', { param: 'something else' });
This is incorrect, as the
other
clause is a fallthrough for values other thanfoo
orbar
.
Vocab will now derive the type of these arguments asStringWithSuggestions<Suggestions>
.
This type is equivalent tostring
, but it enables your IDE to provide suggestions for explicit matches.// `param` can be any string, but "foo" and "bar" will be suggested t('My message', { param: '' });
@vocab/[email protected]
Patch Changes
-
673b16c
#117 Thanks @askoufis! - Deeply parse nested arguments insideplural
argumentsICU plural type arguments can contain arguments in their matches:
{ "My message": { "message": "{numThings, plural, one {{foo} singular} other {{bar} plural}}" } }
These were being parsed incorrectly, resulting in only the top-level plural argument being output in the compiled message type:
// Type error: `foo` and `bar` are not valid arguments t('My message', { numThings: 1, foo: 'foo', bar: 'bar' });
These arguments are now correctly parsed resulting in a correctly typed message:
// Works! t('My message', { numThings: 1, foo: 'foo', bar: 'bar' });
@vocab/[email protected]
[email protected]
@vocab/[email protected]
Patch Changes
-
fc74024
#99 Thanks @askoufis! - Exclude source files from package build -
Updated dependencies [
30d643d
,fc74024
]:- @vocab/[email protected]
- @vocab/[email protected]
- [email protected]
@vocab/[email protected]
@vocab/[email protected]
Patch Changes
-
fc74024
#99 Thanks @askoufis! - Exclude source files from package build -
Updated dependencies [
fc74024
]:- @vocab/[email protected]