Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1984: feat(ts): add TS v3.7/3.8 language features r=spencercorwin a=spencercorwin ### Description of the Change Upgrades Smart-Contract compiler to support new TS language features: Features from TS v3.7: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html - [x] Optional Chaining - [x] Nullish Coalescing - Added in previous TS PR - [x] Assertion Functions - Not supported? - [x] `never`-Returning Functions - No change needed? - [x] Recursive Type Aliases - [x] Uncalled Function Checks - Should be supported without change from us? Features from TS v3.8.1-rc: https://devblogs.microsoft.com/typescript/announcing-typescript-3-8-rc/ - [x] Type-Only Imports and Exports - [x] ECMAScript Private Fields - [x] `export * as ns` Syntax - Added in previous TS PR - [x] Top-Level `await` - Not supported? ### Test Plan - All Unit Tests - `rush test` - `rush e2e` - Optional Chaining - `rush test -t packages/neo-one-smart-contract-compiler/src/__tests__/compile/expression/CallExpressionCompiler.test.ts` - `rush test -t packages/neo-one-smart-contract-compiler/src/__tests__/compile/expression/ElementAccessExpressionCompiler.test.ts` - `rush test -t packages/neo-one-smart-contract-compiler/src/__tests__/compile/expression/PropertyAccessExpressionCompiler.test.ts` - Nullish Coalescing - `rush test -t packages/neo-one-smart-contract-compiler/src/__tests__/compile/expression/ToNullishBooleanHelper.test.ts` - Recursive Type Aliases - `rush test -t packages/neo-one-smart-contract-compiler/src/__tests__/compile/declaration/TypeAliasDeclarationCompiler.test.ts` - Type-Only Imports and Exports - `rush test -t packages/neo-one-typescript-concatenator/src/__tests__/concatenate.test.ts` - ECMAScript Private Fields - `rush test -t packages/neo-one-smart-contract-compiler/src/__tests__/compile/declaration/ClassDeclarationCompiler.test.ts` - `rush test -t packages/neo-one-smart-contract-compiler/src/__tests__/compile/expression/ObjectLiteralExpressionCompiler.test.ts` - `export * as ns` Syntax - `rush test -t packages/neo-one-typescript-concatenator/src/__tests__/concatenate.test.ts` - Top-Level `await` - `rush test -t packages/neo-one-smart-contract-compiler/src/__tests__/compiler/expression/AwaitExpressionCompiler.test.ts` ### Alternate Designs None. ### Benefits - We support the latest language features for writing Smart Contracts in TS. ### Possible Drawbacks - Prettier doesn't support some TS v3.8 syntax yet, so all Prettier checks will fail on the `neo-one-typescript-concatenator` package until they/we update Prettier. They have an issue open for this [here](prettier/prettier#7263). They are waiting for TS 3.8 support in `typescript-eslint` for the new AST [here](typescript-eslint/typescript-eslint#1465). This is easy to ignore for now. - Possibly unforeseen problems. ### Applicable Issues #1889 Co-authored-by: Spencer Corwin <spencercorwin@icloud.com>
- Loading branch information
Showing
20 changed files
with
717 additions
and
22 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
common/changes/@neo-one/smart-contract-compiler/new-ts_2020-02-27-21-52.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@neo-one/smart-contract-compiler", | ||
"comment": "Add support for new language features in TS v3.7, v3.8", | ||
"type": "minor" | ||
} | ||
], | ||
"packageName": "@neo-one/smart-contract-compiler", | ||
"email": "spencercorwin@icloud.com" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
common/changes/@neo-one/typescript-concatenator/new-ts_2020-02-27-21-52.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@neo-one/typescript-concatenator", | ||
"comment": "Add support for new language features in TS v3.7, v3.8", | ||
"type": "minor" | ||
} | ||
], | ||
"packageName": "@neo-one/typescript-concatenator", | ||
"email": "spencercorwin@icloud.com" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...ler/src/__tests__/compile/declaration/__snapshots__/ClassDeclarationCompiler.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.