Skip to content

Commit

Permalink
fix: handle object shortened
Browse files Browse the repository at this point in the history
  • Loading branch information
imranbarbhuiya committed Jul 16, 2023
1 parent 382da99 commit 63a6b6a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/parseFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const parseFile = (filePath: string, options: OptionsWithDefault) => {
let variables: string[] = [];
if (secondArg && ts.isObjectLiteralExpression(secondArg)) {
variables = secondArg.properties.map((prop) => {
if (ts.isPropertyAssignment(prop)) {
if (prop.name) {
return prop.name.getText(sourceFile);
}

Expand Down
4 changes: 3 additions & 1 deletion tests/fixtures/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ t(a);

t(`a:${a}`);

t('Hello world', { name: 'John Doe' });
const b = 'b';

t('Hello world', { name: 'John Doe', b });

// i18n-validate-disable-next-line custom fn
t('ok');

0 comments on commit 63a6b6a

Please sign in to comment.