Skip to content

Commit 6cbd083

Browse files
authored
fix: typo (#176)
1 parent 2a108d6 commit 6cbd083

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

src/report.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const enum ReportCodes {
2323
REQUIRED_PARAMETER,
2424
INVALID_PARAMETER_TYPE,
2525
NOT_SUPPORTED_PRESERVE,
26-
ORVERRIDE_ELEMENT_CHILDREN,
26+
OVERRIDE_ELEMENT_CHILDREN,
2727
__EXTEND_POINT__
2828
}
2929

@@ -35,7 +35,7 @@ const ReportMessages: { [code: number]: string } = {
3535
[ReportCodes.REQUIRED_PARAMETER]: `Required parameter: {0}`,
3636
[ReportCodes.INVALID_PARAMETER_TYPE]: `Required parameter: {0}`,
3737
[ReportCodes.NOT_SUPPORTED_PRESERVE]: `Not supportted 'preserve': {0}`,
38-
[ReportCodes.ORVERRIDE_ELEMENT_CHILDREN]: `v-t will override element children: {0}`
38+
[ReportCodes.OVERRIDE_ELEMENT_CHILDREN]: `v-t will override element children: {0}`
3939
}
4040

4141
export function getReportMessage(
@@ -60,20 +60,20 @@ function createExtensionsError(
6060

6161
export function report(
6262
code: ReportCodes,
63-
optinos: ReportOptions = {}
63+
options: ReportOptions = {}
6464
): void | ExtensionsError {
6565
const mode =
66-
optinos.mode &&
67-
isString(optinos.mode) &&
68-
['warn', 'error'].includes(optinos.mode)
69-
? optinos.mode
66+
options.mode &&
67+
isString(options.mode) &&
68+
['warn', 'error'].includes(options.mode)
69+
? options.mode
7070
: 'warn'
7171

72-
const msg = getReportMessage(code, optinos.args)
72+
const msg = getReportMessage(code, options.args)
7373
if (mode === 'warn') {
7474
console.warn('[vue-i18n-extensions] ' + msg)
7575
} else {
7676
// error
77-
throw createExtensionsError(code, msg, optinos.loc)
77+
throw createExtensionsError(code, msg, options.loc)
7878
}
7979
}

src/transform.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ export interface TransformVTDirectiveOptions<
5252
* I18n instance
5353
*
5454
* @remarks
55-
* If this option is specified, `v-t` custom diretive transform uses an I18n instance to pre-translate.
55+
* If this option is specified, `v-t` custom directive transform uses an I18n instance to pre-translate.
5656
* The translation will use the global resources registered in the I18n instance,
57-
* that is, `v-t` diretive transform is also a limitation that the resources of each component cannot be used.
57+
* that is, `v-t` directive transform is also a limitation that the resources of each component cannot be used.
5858
*/
5959
i18n?: I18n<Messages, DateTimeFormats, NumberFormats, Legacy>
6060
/**
@@ -163,7 +163,7 @@ export function transformVTDirective<
163163
// TODO: throw error with context.OnError
164164
// NOTE: We need to support from @vue/compiler-core
165165
// https://github.com/vuejs/vue-next/issues/1147
166-
report(ReportCodes.ORVERRIDE_ELEMENT_CHILDREN, {
166+
report(ReportCodes.OVERRIDE_ELEMENT_CHILDREN, {
167167
mode: 'error',
168168
args: [node.loc.source || ''],
169169
loc: node.loc
@@ -432,7 +432,7 @@ function generateLegacyCode(
432432
generateNamedCode(builder, params.named)
433433
builder.push(` }`)
434434
} else {
435-
// generaete plural
435+
// generate plural
436436
builder.push(`, ${toDisplayString(params.options.plural)}`)
437437
if (isString(params.options.locale)) {
438438
// generate locale

src/transpiler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function getObjectMemberValue(node: any): string {
8888
return node.name
8989
} else if (node.type === 'MemberExpression') {
9090
const paths: string[] = []
91-
collectMermberPath(node, paths)
91+
collectMemberPath(node, paths)
9292
paths.reverse()
9393
return paths.join('.')
9494
} else {
@@ -115,15 +115,15 @@ function traverseObjectMember(node: any, target: any): void {
115115
})
116116
}
117117

118-
function collectMermberPath(node: any, paths: string[]): void {
118+
function collectMemberPath(node: any, paths: string[]): void {
119119
if (node.type === 'Identifier') {
120120
paths.push(node.name)
121121
return
122122
}
123123

124124
if (node.property.type === 'Identifier') {
125125
paths.push(node.property.name)
126-
return collectMermberPath(node.object, paths)
126+
return collectMemberPath(node.object, paths)
127127
}
128128
}
129129

test/transform.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ test('have child elements', () => {
148148
directiveTransforms: { t: transformVT }
149149
})
150150
}).toThrowError(
151-
getReportMessage(ReportCodes.ORVERRIDE_ELEMENT_CHILDREN, source)
151+
getReportMessage(ReportCodes.OVERRIDE_ELEMENT_CHILDREN, source)
152152
)
153153
})
154154

0 commit comments

Comments
 (0)