1
- import { h , Fragment } from 'vue'
1
+ import { h , Fragment , defineComponent } from 'vue'
2
2
import { isNumber , isString , isObject } from '@intlify/shared'
3
3
import { TransrateVNodeSymbol } from '../composer'
4
4
import { useI18n } from '../i18n'
5
5
import { baseFormatProps } from './base'
6
6
import { assign } from '@intlify/shared'
7
7
8
- import type { SetupContext , VNodeChild , RenderFunction } from 'vue'
8
+ /* eslint-disable @typescript-eslint/no-unused-vars */
9
+ import type {
10
+ SetupContext ,
11
+ VNodeChild ,
12
+ // NOTE: avoid https://github.com/microsoft/rushstack/issues/1050
13
+ // @ts -ignore
14
+ DefineComponent ,
15
+ // @ts -ignore
16
+ ComponentOptionsMixin ,
17
+ // @ts -ignore
18
+ AllowedComponentProps ,
19
+ // @ts -ignore
20
+ VNodeProps ,
21
+ // @ts -ignore
22
+ ComponentCustomProps
23
+ } from 'vue'
24
+ /* eslint-enable @typescript-eslint/no-unused-vars */
9
25
import type { Composer , ComposerInternal } from '../composer'
10
26
import type { TranslateOptions } from '@intlify/core-base'
11
27
import type { NamedValue } from '@intlify/runtime'
@@ -78,7 +94,7 @@ export interface TranslationProps extends BaseFormatProps {
78
94
*
79
95
* @VueI 18nComponent
80
96
*/
81
- export const Translation = {
97
+ export const Translation = /* #__PURE__*/ defineComponent ( {
82
98
/* eslint-disable */
83
99
name : 'i18n-t' ,
84
100
props : assign (
@@ -96,11 +112,13 @@ export const Translation = {
96
112
baseFormatProps
97
113
) ,
98
114
/* eslint-enable */
99
- setup ( props : TranslationProps , context : SetupContext ) : RenderFunction {
115
+ setup ( props , context ) {
100
116
const { slots, attrs } = context
117
+ // NOTE: avoid https://github.com/microsoft/rushstack/issues/1050
101
118
const i18n =
102
119
props . i18n ||
103
- ( useI18n ( { useScope : props . scope } ) as Composer & ComposerInternal )
120
+ ( useI18n ( { useScope : props . scope as 'global' | 'parent' } ) as Composer &
121
+ ComposerInternal )
104
122
const keys = Object . keys ( slots ) . filter ( key => key !== '_' )
105
123
106
124
return ( ) : VNodeChild => {
@@ -124,7 +142,7 @@ export const Translation = {
124
142
: h ( Fragment , assignedAttrs , children )
125
143
}
126
144
}
127
- }
145
+ } )
128
146
129
147
function getInterpolateArg (
130
148
{ slots } : SetupContext ,
0 commit comments