Open AaronNGray opened 4 years ago
I also tried building a recompiled chrome-promise
using typescript@3.9.5
and es6, and es2020, and have got 7 errors :-
C:\Users\aaron\GitHub\chrome-promise>npm run compileTypescript
> chrome-promise@3.0.5 compileTypescript C:\Users\aaron\GitHub\chrome-promise
> tsc type-definitions/create-type-definitions.ts --lib es5,es2015,dom
type-definitions/classes.ts:92:32 - error TS2345: Argument of type 'Identifier' is not assignable to parameter of type 'LiteralExpression | BooleanLiteral | PrefixUnaryExpression'.
Type 'Identifier' is not assignable to type 'LiteralExpression'.
Property '_literalExpressionBrand' is missing in type 'Identifier'.
92 ts.createLiteralTypeNode(ts.createIdentifier(typeName)),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
type-definitions/classes.ts:102:11 - error TS2322: Type 'NodeArray<HeritageClause> | undefined[]' is not assignable to type 'HeritageClause[]'.
Type 'NodeArray<HeritageClause>' is not assignable to type 'HeritageClause[]'.
Property '[Symbol.unscopables]' is missing in type 'NodeArray<HeritageClause>'.
102 const heritageClauses: ts.HeritageClause[] = interfaceDeclaration.heritageClauses || [];
~~~~~~~~~~~~~~~
type-definitions/classes.ts:113:7 - error TS2345: Argument of type 'NodeArray<Decorator>' is not assignable to parameter of type 'Decorator[]'.
Property '[Symbol.unscopables]' is missing in type 'NodeArray<Decorator>'.
113 interfaceDeclaration.decorators,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
type-definitions/create-type-definitions.ts:43:23 - error TS2339: Property 'push' does not exist on type 'NodeArray<Statement>'.
43 outputFile.statements.push(chromepClass);
~~~~
type-definitions/create-type-definitions.ts:45:23 - error TS2339: Property 'push' does not exist on type 'NodeArray<Statement>'.
45 outputFile.statements.push(...chromepApiStatements);
~~~~
type-definitions/create-type-definitions.ts:62:102 - error TS2345: Argument of type 'Identifier' is not assignable to parameter of type 'LiteralExpression | BooleanLiteral | PrefixUnaryExpression'.
Type 'Identifier' is not assignable to type 'LiteralExpression'.
62 ts.createPropertySignature(undefined, 'Promise', createQuestionToken(), ts.createLiteralTypeNode(ts.createIdentifier('Function')), undefined),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
type-definitions/helpers.ts:18:10 - error TS2352: Type 'NodeArray<Node>' cannot be converted to type 'Modifier[]'.
Property '[Symbol.unscopables]' is missing in type 'NodeArray<Node>'.
18 return ts.createNodeArray(kinds.map(k => ts.createNode(k))) as ts.Modifier[];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
towards a quick fix :-
Looking at this code it would be better replaced by a transformer.
npm install --save-dev @types/chrome@0.0.96
from https://github.com/tfoxy/chrome-promise/issues/32 fixed the first errors.
But I think it would be good to update type-definitions
to use mode modern TypeScript code.
npm install --save-dev @types/chrome@0.0.96
from #32 fixed the first errors. But I think it would be good to update
type-definitions
to use mode modern TypeScript code.
this kinda work around helped me in this case https://github.com/extend-chrome/storage/issues/11
If anybody is still wondering... apparently this lib is not longer needed with Chrome manifest v3, because all Chrome APIs are already promisified. So basically there is no need for this library. @Quantumplation @tfoxy. Currently I only use it for backwards compatibility for chrome extensions that still run manifest v3.
I am having problems with using TypeScript@3.9.5 with chrome-promise. My project needs tsc v3.9.5 to compile as it uses es2020 and other features.
I have installed
@types/node:latest
andtypescript@3.9.5
, and am getting the following :-