refactor: early compatibility with TypeScript 3.5 (#31174)
This commit fixes a couple of issues with TS 3.5 compatibility in order to unblock migration of g3. Mostly 'any's are added, and there are no behavior changes. PR Close #31174
This commit is contained in:

committed by
Kara Erickson

parent
34eaafdf40
commit
fad03c3c14
@ -418,8 +418,9 @@ export class MetadataCollector {
|
||||
const maybeFunc = maybeGetSimpleFunction(functionDeclaration);
|
||||
if (name) {
|
||||
if (!metadata) metadata = {};
|
||||
metadata[name] =
|
||||
maybeFunc ? recordEntry(maybeFunc.func, node) : {__symbolic: 'function'};
|
||||
// TODO(alxhub): The literal here is not valid FunctionMetadata.
|
||||
metadata[name] = maybeFunc ? recordEntry(maybeFunc.func, node) :
|
||||
({ __symbolic: 'function' } as any);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -448,13 +449,15 @@ export class MetadataCollector {
|
||||
if (typeof enumValue === 'number') {
|
||||
nextDefaultValue = enumValue + 1;
|
||||
} else if (name) {
|
||||
// TODO(alxhub): 'left' here has a name propery which is not valid for
|
||||
// MetadataSymbolicSelectExpression.
|
||||
nextDefaultValue = {
|
||||
__symbolic: 'binary',
|
||||
operator: '+',
|
||||
left: {
|
||||
__symbolic: 'select',
|
||||
expression: recordEntry({__symbolic: 'reference', name: enumName}, node), name
|
||||
}
|
||||
} as any,
|
||||
};
|
||||
} else {
|
||||
nextDefaultValue =
|
||||
|
@ -555,7 +555,7 @@ export class Evaluator {
|
||||
return !operand;
|
||||
}
|
||||
}
|
||||
let operatorText: string;
|
||||
let operatorText: '+'|'-'|'~'|'!';
|
||||
switch (prefixUnaryExpression.operator) {
|
||||
case ts.SyntaxKind.PlusToken:
|
||||
operatorText = '+';
|
||||
|
Reference in New Issue
Block a user