-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
WIP: feat: new ast for typescript 3.8 #1465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
Private class properties in tsx are supported by typescript but so far they are not documented (i'm unsure if this is intended) i updated PR with links to estree spec proposals |
Which is the difference? Is it something that should be fixed in Babel? |
Conflicts: packages/experimental-utils/package.json
@nicolo-ribaudo for code export * as ns from 'x' babel reports babel: it looks like typescript returns same range for NamespaceExport and Identifier( |
Conflicts: package.json packages/typescript-estree/package.json yarn.lock
FYI that range difference was a bug that is now fixed: microsoft/TypeScript#36762 |
Is this PR actively being worked on? It looks like there haven't been any commits for a while. Edit: I'm sorry – I didn't mean to convey a sense of entitlement. I was just looking for context for my own planning purposes. |
There's a lot of work that needs to happen here. For import/export type, they are TS specific features, so we are relatively free to implement them. However we need to be sure we're syncing up with babel so that our AST representations match. Both packages are part of one ecosystem, so we need to match up. (babel/babel#11171) With the 3.7 release, we made the decision to jump the gun on the AST for both nullish coalescing and optional chaining, and used babel's representation. However it looks like the ESTree spec will go with a different representation, which ESLint will then build on top of. So in order to support the ecosystem, we'll have to migrate to that representation via a non-trival amount of work, and a major version bump. So for private class fields/methods, and There is a lot of volunteers working on this across many projects, so it takes time as they find moments in their free time to work on it. |
Thanks for that context. I've updated my original comment to be clear that I don't feel entitled to anything. I appreciate the volunteers. |
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>
DO NOT MERGE,
This is branch contains so far only test scenarios for upcoming typescript 3.8.
TODO:
Private class properties in tsximport type
in TypeScript babel/babel#10981import type
in TypeScript babel/babel#10981Implemented as draft (AST may change base on tickets above:
exportKind: 'type' | 'value'
importKind: 'type' | 'value'
Issues:
export * as ns
between babel and ts - Add exported property to ExportAllDeclaration estree/estree#205import foo, {bar} from "foo";
Cannot read property 'kind' of undefined
prettier/prettier#6608
prettier/prettier#7263
import-js/eslint-plugin-import#645
fixes #1436