Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/vue-i18n-core/test/composer.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,13 @@ test('strict composer with direct options', () => {
})
).toEqualTypeOf<Intl.DateTimeFormatPart[]>()

// ComposerDateTimeFormatting with ISO 8601 string
expectTypeOf(strictDirectComposer.d('2022-08-08T08:56:45.846Z')).toEqualTypeOf<string>()
expectTypeOf(strictDirectComposer.d('2022-08-08T08:56:45.846Z', 'short')).toEqualTypeOf<string>()
expectTypeOf(
strictDirectComposer.d('2022-08-08T08:56:45.846Z', { key: 'short', locale: 'zh' })
).toEqualTypeOf<string>()

// ComposerNumberFormatting
expectTypeOf(strictDirectComposer.n(1)).toEqualTypeOf<string>()
expectTypeOf(strictDirectComposer.n(1, 'currency', 'zh')).toEqualTypeOf<string>()
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-i18n/src/vue.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ declare module 'vue' {
* @returns formatted value
*/
$d<
Value extends number | Date = number,
Value extends number | Date | string = number,
Key extends string = string,
DefinedDateTimeFormat extends RemovedIndexResources<DefineDateTimeFormat> =
RemovedIndexResources<DefineDateTimeFormat>,
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-i18n/src/vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ export interface ComponentCustomProperties {
* @returns formatted value
*/
$d<
Value extends number | Date = number,
Value extends number | Date | string = number,
Key extends string = string,
DefinedDateTimeFormat extends RemovedIndexResources<DefineDateTimeFormat> =
RemovedIndexResources<DefineDateTimeFormat>,
Expand Down
Loading