Skip to content

Commit

Permalink
Support newer TypeScript syntax (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
wdoug authored Apr 21, 2021
1 parent d8fb5ec commit 788d6e1
Show file tree
Hide file tree
Showing 8 changed files with 434 additions and 304 deletions.
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
"author": "Felix Kling",
"license": "MIT",
"dependencies": {
"@babel/core": "^7.1.6",
"@babel/parser": "^7.1.6",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.1.0",
"@babel/plugin-proposal-optional-chaining": "^7.1.0",
"@babel/plugin-transform-modules-commonjs": "^7.1.0",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-typescript": "^7.1.0",
"@babel/register": "^7.0.0",
"@babel/core": "^7.13.16",
"@babel/parser": "^7.13.16",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8",
"@babel/plugin-proposal-optional-chaining": "^7.13.12",
"@babel/plugin-transform-modules-commonjs": "^7.13.8",
"@babel/preset-flow": "^7.13.13",
"@babel/preset-typescript": "^7.13.0",
"@babel/register": "^7.13.16",
"babel-core": "^7.0.0-bridge.0",
"colors": "^1.1.2",
"flow-parser": "0.*",
Expand Down
1 change: 1 addition & 0 deletions parser/babel5Compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const options = {
'dynamicImport',
'nullishCoalescingOperator',
'optionalChaining',
['decorators', {decoratorsBeforeExport: false}],
],
};

Expand Down
5 changes: 5 additions & 0 deletions sample/__testfixtures__/reverse-identifiers.input.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
var firstWord = 'Hello ';
var secondWord = 'world';
var message = firstWord + secondWord;

class Foo {
@decorated
*bar() { }
}
5 changes: 5 additions & 0 deletions sample/__testfixtures__/reverse-identifiers.output.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
var droWtsrif = 'Hello ';
var droWdnoces = 'world';
var egassem = droWtsrif + droWdnoces;

class ooF {
@detaroced
*rab() { }
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { Stream } from 'stream';

const firstWord = 'Hello ';
const secondWord = 'world';
const message = firstWord + secondWord;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { maertS } from 'stream';

const droWtsrif = 'Hello ';
const droWdnoces = 'world';
const egassem = droWtsrif + droWdnoces;

const egasseMteg = (): string => egassem
const egasseMteg = (): string => egassem
5 changes: 3 additions & 2 deletions src/collections/__tests__/VariableDeclarator-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('VariableDeclarators', function() {
'var foo = 42;',
'var bar = require("module");',
'var baz = require("module2");',
'function func() {',
'function first() {',
' var x = bar;',
' bar.someMethod();',
' func1(bar);',
Expand All @@ -40,7 +40,7 @@ describe('VariableDeclarators', function() {
'foo.bar();',
'foo[bar]();',
'bar.foo();',
'function func() {',
'function second() {',
' var blah;',
' var obj = {',
' blah: 4,',
Expand All @@ -52,6 +52,7 @@ describe('VariableDeclarators', function() {
' blah() {}',
' }',
'}',
'class Foo { @decorator\n*stuff() {} }',
'<Component foo={foo} />',
].join('\n'), {parser: getParser()}).program];
});
Expand Down
698 changes: 406 additions & 292 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 788d6e1

Please sign in to comment.