Skip to content
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

Support TypeScript 3.0 #868

Closed
evmar opened this issue Jul 16, 2018 · 3 comments
Closed

Support TypeScript 3.0 #868

evmar opened this issue Jul 16, 2018 · 3 comments

Comments

@evmar
Copy link
Contributor

evmar commented Jul 16, 2018

I tried using 3.0.0-rc and found the following.

  • SymbolWriter and related APIs were removed
  • getCombinedModifierFlags now only works for some node types
  • getTypeAtLocation may return undefined (maybe in cases where type checking failed? not sure)
  • various other nullability changes

I think with Martin's imminent transformers change we should wait for that before fixing these.

src/typescript.ts:24:2821 - [...] typescript/lib/typescript"' has no exported member 'SymbolWriter'.

24 export {[...], visitParameterList, WriteFileCallback} from 'typescript';

src/util.ts:60:39 - error TS2345: Argument of type 'Node' is not assignable to parameter of type 'Declaration'.
  Property '_declarationBrand' is missing in type 'Node'.

60   return (ts.getCombinedModifierFlags(node) & flag) !== 0;
                                         ~~~~
src/enum_transformer.ts:55:7 - error TS2532: Object is possibly 'undefined'.

55   if (type.flags & ts.TypeFlags.NumberLike) {
         ~~~~
src/transformer_sourcemap.ts:83:7 - error TS2322: Type 'undefined' is not assignable to type 'Node'.

83       node.parent = undefined;
         ~~~~~~~~~~~
src/type-translator.ts:241:38 - error TS2339: Property 'getSymbolDisplayBuilder' does not exist on type 'TypeChecker'.

241     const builder = this.typeChecker.getSymbolDisplayBuilder();
                                         ~~~~~~~~~~~~~~~~~~~~~~~
src/type-translator.ts:302:43 - error TS2345: Argument of type 'Node' is not assignable to parameter of type 'Declaration'.

302           if (ts.getCombinedModifierFlags(current) & ts.ModifierFlags.Ambient) isAmbient = true;
                                              ~~~~~~~
src/type-translator.ts:655:45 - error TS2345: Argument of type 'Type | undefined' is not assignable to parameter of type 'Type'.
  Type 'undefined' is not assignable to type 'Type'.

655         typeStr += `this: (${this.translate(thisType)})`;
                                                ~~~~~~~~
src/tsickle.ts:549:17 - error TS2532: Object is possibly 'undefined'.

549       let sym = type.symbol;
                    ~~~~
src/tsickle.ts:584:54 - error TS2345: Argument of type 'Type | undefined' is not assignable to parameter of type 'Type'.
  Type 'undefined' is not assignable to type 'Type'.

584     return this.newTypeTranslator(context).translate(type);
                                                         ~~~~
src/tsickle.ts:909:13 - error TS2532: Object is possibly 'undefined'.

909         if (type.flags & ts.TypeFlags.Union) {
                ~~~~
src/tsickle.ts:1014:14 - error TS2532: Object is possibly 'undefined'.

1014         if (!t.getStringIndexType()) return false;
                  ~
src/tsickle.ts:1027:43 - error TS2345: Argument of type 'Type | undefined' is not assignable to parameter of type 'Type'.
  Type 'undefined' is not assignable to type 'Type'.

1027             this.typeChecker.typeToString(t) +
                                               ~
src/tsickle.ts:1253:21 - error TS2532: Object is possibly 'undefined'.

1253     const keyword = varStmt.declarationList.getFirstToken().getText();
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@hbobenicio
Copy link

So... does tsickle support typescript 3 yet?
I have an Angular 6.1 library project that depends on "tsickle": ">=0.29.0".
I'm trying to upgrade it to Angular 7 as the docs suggests with:

npx ng update @angular/cli @angular/core
                  Package "tsickle" has an incompatible peer dependency to "typescript" (requires ">=2.4.2 <2.9", would install "3.1.6").
Incompatible peer dependencies found. See above.

So, it seems like the new @angular/core version tries to install typescript 3.1.6 which is incompatible with tsickles typescript peerDependency.

Well... the Angulars issue 25200 was actually closed, but this issue here is still open and I see people there just forcing upgrades and getting warnings like:

npm WARN tsickle@0.30.0 requires a peer of typescript@>=2.4.2 <2.9 but none is installed. You must install peer dependencies yourself.

tsickle has already new release versions like 0.31, but even new angular 7 projects with ng generate library my-lib would still add 'tsickle >= 0.29' to package.json alongside with "typescript": "~3.1.6".

so Is stickle really typescript 3 compatible? If so, is it just a matter on updating its typescript peerDependency version or could we safely upgrade tsickle to a new version which supports it?

@hbobenicio
Copy link

This comment says that "tsickle version 0.33.1 now supports TypeScript 3.1.1".

@evmar
Copy link
Contributor Author

evmar commented Nov 30, 2018

We now require a peer dep of 3.1:

"typescript": "~3.1.3 || ~3.2.0-rc"

@evmar evmar closed this as completed Nov 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants