support typescript 3.7 and optinal chaining
hitbear518 opened this issue · comments
hitbear518 commented
after upgrade to typescript 3.7.2 and use optional chaining,
when I run ttag update --numberedExpressions=true i18n/zh.po src/
it give such error:
as a JavaScript value binding, and "@babel/plugin-transform-typescript"
never encountered it as a TypeScript type declaration.
It will be treated as a JavaScript value.
This problem is likely caused by another plugin injecting
"undefined" without registering it in the scope tracker. If you are the author
of that plugin, please use "scope.registerDeclaration(declarationPath)".
⠼ src/Trade/Kline.tsxSyntaxError: /Users/sen/Projects/last-platform-web/new-web/src/Trade/OrderHistory.tsx: Support for the experimental syntax 'optionalChaining' isn't currently enabled (18:24):
16 | export default function OrderHistory() {
17 | const tradeData = TradeDataContainer.useContainer();
> 18 | console.log(tradeData?.buyDepthList)
| ^
19 | if (!tradeData) {
20 | return null;
21 | }
Add @babel/plugin-proposal-optional-chaining (https://git.io/vb4Sk) to the 'plugins' section of your Babel config to enable transformation.
at Object.raise (/Users/sen/Projects/last-platform-web/new-web/node_modules/@babel/parser/lib/index.js:6420:17)
at Object.expectPlugin (/Users/sen/Projects/last-platform-web/new-web/node_modules/@babel/parser/lib/index.js:7778:18)
at Object.parseSubscript (/Users/sen/Projects/last-platform-web/new-web/node_modules/@babel/parser/lib/index.js:8592:12)
at Object.parseSubscript (/Users/sen/Projects/last-platform-web/new-web/node_modules/@babel/parser/lib/index.js:5292:18)
at Object.parseSubscripts (/Users/sen/Projects/last-platform-web/new-web/node_modules/@babel/parser/lib/index.js:8577:19)
at Object.parseExprSubscripts (/Users/sen/Projects/last-platform-web/new-web/node_modules/@babel/parser/lib/index.js:8566:17)
at Object.parseMaybeUnary (/Users/sen/Projects/last-platform-web/new-web/node_modules/@babel/parser/lib/index.js:8536:21)
at Object.parseMaybeUnary (/Users/sen/Projects/last-platform-web/new-web/node_modules/@babel/parser/lib/index.js:5672:20)
at Object.parseExprOps (/Users/sen/Projects/last-platform-web/new-web/node_modules/@babel/parser/lib/index.js:8402:23)
at Object.parseMaybeConditional (/Users/sen/Projects/last-platform-web/new-web/node_modules/@babel/parser/lib/index.js:8375:23) {
pos: 508,
loc: Position { line: 18, column: 23 },
missingPlugin: [ 'optionalChaining' ],
code: 'BABEL_PARSE_ERROR'
}
✖ Failed to extract translations
Alexander commented
Hi @hitbear518! Thanks for the feature request. I have added optional chaining support in 1.7.25
. Let me know if that works.
hitbear518 commented
Hi, it worked.
Great work! 👍