Skip to content

Commit fbfc57f

Browse files
committed
build-type: replace number|string to FluentArgument
1 parent 3551943 commit fbfc57f

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

example/assets/locales/pt-br/translations.ftl.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This file is automatically generated.
22
// Please do not change this file!
33

4-
import { FluentBundle } from '@fluent/bundle'
4+
import { FluentBundle, FluentArgument } from '@fluent/bundle'
55

66
type Pattern<T extends MessagesKey> = T | Parameters<FluentBundle['formatPattern']>[0]
77

@@ -23,7 +23,7 @@ type MessagesKey = 'hello' |
2323
'bye'
2424
type PatternArguments<T extends MessagesKey> = (
2525
T extends 'hello'
26-
? [{ 'name': string | number }]:
26+
? [{ 'name': FluentArgument }]:
2727
T extends 'how-are-you'
2828
? []:
2929
T extends 'bye'

src/build-header.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const bannerMessage = (
55
)
66

77
const header = dedent`
8-
import { FluentBundle } from '@fluent/bundle'
8+
import { FluentBundle, FluentArgument } from '@fluent/bundle'
99
1010
type Pattern<T extends MessagesKey> = T | Parameters<FluentBundle['formatPattern']>[0]
1111

src/build-type-pattern-arguments.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const messageVariablesName = (message) =>
66
.filter(placeable => placeable.expression.type === 'VariableReference')
77
.map(placeable => placeable.expression.id.name)
88

9-
const wrapVariables = variables => variables.map(i => `'${i}': string | number`)
9+
const wrapVariables = variables => variables.map(i => `'${i}': FluentArgument`)
1010

1111
const hasVariables = variables => variables.length > 0
1212

test/index.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ test('Should match the types definitions', async () => {
1414
// This file is automatically generated.
1515
// Please do not change this file!
1616
17-
import { FluentBundle } from '@fluent/bundle'
17+
import { FluentBundle, FluentArgument } from '@fluent/bundle'
1818
1919
type Pattern<T extends MessagesKey> = T | Parameters<FluentBundle['formatPattern']>[0]
2020
@@ -36,7 +36,7 @@ test('Should match the types definitions', async () => {
3636
'bye'
3737
type PatternArguments<T extends MessagesKey> = (
3838
T extends 'hello'
39-
? [{ 'name': string | number }]:
39+
? [{ 'name': FluentArgument }]:
4040
T extends 'how-are-you'
4141
? []:
4242
T extends 'bye'

0 commit comments

Comments
 (0)