Skip to content

Commit

Permalink
fix(typescript): add support to typescript 4.9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
uittorio committed Dec 8, 2022
1 parent b782c5d commit 77bfaba
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 50 deletions.
7 changes: 2 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
interval: "daily"
ignore:
- dependency-name: "ttypescript"
# the latest version does not have release notes or documentation
# https://github.com/cevek/ttypescript/issues/131
- dependency-name: "@types/node"
# @types/node versions follow node versions. this project currently supports node lts/gallium and lts/fermium
versions: ['>=17.0.0']
versions: [ '>=17.0.0' ]
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@
"ts-loader": "9.3.1",
"ts-node": "10.9.1",
"tsconfig-paths": "4.1.0",
"ttypescript": "1.5.12",
"typescript": "4.7.4",
"ttypescript": "^1.5.13",
"typescript": "^4.9.3",
"webpack": "5.74.0",
"webpack-cli": "4.10.0",
"webpack-merge": "5.8.0",
Expand Down
5 changes: 4 additions & 1 deletion src/transformer/descriptor/mock/mockProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ export function GetMockPropertiesFromDeclarations(
): ts.CallExpression {
const propertiesFilter: PropertyLike[] = list.filter(
(member: PropertyLike) => {
const modifiers: ts.ModifiersArray | undefined = member.modifiers;
const modifiers:
| ts.NodeArray<ts.Modifier>
| ts.NodeArray<ts.ModifierLike>
| undefined = member.modifiers;

if (IsTypescriptType(member)) {
// Workaround to remove any properties coming from typescript/lib
Expand Down
48 changes: 20 additions & 28 deletions src/typescriptFactory/typescriptFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,28 +212,24 @@ export function createPropertySignature(
}

export function createParameter(parameterName: string): ParameterDeclaration {
const modifiers: undefined = undefined;
const dotDotDotToken: undefined = undefined;
return core.ts.factory.createParameterDeclaration(
undefined,
undefined,
undefined,
createIdentifier(parameterName),
undefined,
undefined,
undefined
modifiers,
dotDotDotToken,
createIdentifier(parameterName)
);
}

export function createParameterFromIdentifier(
identifier: Identifier
): ParameterDeclaration {
const modifiers: undefined = undefined;
const dotDotDotToken: undefined = undefined;
return core.ts.factory.createParameterDeclaration(
undefined,
undefined,
undefined,
identifier,
undefined,
undefined,
undefined
modifiers,
dotDotDotToken,
identifier
);
}

Expand All @@ -245,7 +241,6 @@ export function createMethod(
const parameters: ParameterDeclaration[] = parameterNames.map(
(parameterName: Identifier) =>
core.ts.factory.createParameterDeclaration(
undefined,
undefined,
undefined,
parameterName,
Expand All @@ -254,15 +249,19 @@ export function createMethod(
undefined
)
);
const modifiers: undefined = undefined;
const asteriskToken: undefined = undefined;
const questionToken: undefined = undefined;
const typeParameters: undefined = undefined;
const type: undefined = undefined;
return core.ts.factory.createMethodDeclaration(
undefined,
undefined,
undefined,
modifiers,
asteriskToken,
createIdentifier(methodName),
undefined,
undefined,
questionToken,
typeParameters,
parameters,
undefined,
type,
body
);
}
Expand Down Expand Up @@ -335,12 +334,6 @@ export function createFunctionTypeNode(typeNode: TypeNode): FunctionTypeNode {
return core.ts.factory.createFunctionTypeNode([], [], typeNode);
}

export function createNode(): Node {
return core.ts.factory.createKeywordTypeNode(
core.ts.SyntaxKind.NumberKeyword
);
}

export function createObjectLiteral(
properties?: readonly ObjectLiteralElementLike[],
multiLine?: boolean
Expand Down Expand Up @@ -431,7 +424,6 @@ export function createImportAllAs(
filenameToImportFrom: string
): ImportDeclaration {
return core.ts.factory.createImportDeclaration(
[],
[],
core.ts.factory.createImportClause(
false,
Expand Down

0 comments on commit 77bfaba

Please sign in to comment.