lukasgeiter / gettext-extractor

A flexible and powerful Gettext message extractor with support for JavaScript, TypeScript, JSX and HTML.
MIT License
98 stars 21 forks source link

Variable with type and without initializer causes error #58

Closed juanrgm closed 1 year ago

juanrgm commented 1 year ago

This code

let a = __('hello'), b: string

throws:

node_modules/gettext-extractor/dist/js/extractors/comments.js:112
            if (lineNumber === sourceFile.getLineAndCharacterOfPosition(nodes[index + 1].getStart()).line) {
                                                                                         ^

TypeError: Cannot read properties of undefined (reading 'getStart')

And this works:

let a = __('hello'), b: string = ''
lukasgeiter commented 1 year ago

Thanks for reporting this bug! I just released a fix in version 3.6.1