fix: add strict types to build scripts and remove all any usage

Replace all implicit and explicit any types in build scripts with
proper TypeScript Compiler API types (Decorator, ClassDeclaration,
MethodDeclaration, Identifier, SourceFile, etc.). Add PackageJson
and InjectableClassEntry interfaces. Fix return types, null checks,
and type assertions throughout all transformer scripts.
This commit is contained in:
Daniel Sogl
2026-03-21 16:11:27 -07:00
parent 6453f2ab78
commit 62956e429c
9 changed files with 160 additions and 108 deletions
+17 -5
View File
@@ -1,11 +1,21 @@
import { factory, PropertyDeclaration } from 'typescript';
import {
ClassElement,
factory,
GetAccessorDeclaration,
Identifier,
PropertyDeclaration,
SetAccessorDeclaration,
} from 'typescript';
import { getDecorator, getDecoratorName } from '../helpers';
export function transformProperty(members: any[], index: number) {
export function transformProperty(
members: ClassElement[],
index: number
): [GetAccessorDeclaration, SetAccessorDeclaration] | PropertyDeclaration {
const property = members[index] as PropertyDeclaration,
decorator = getDecorator(property),
decoratorName = getDecoratorName(decorator);
decoratorName = decorator ? getDecoratorName(decorator) : undefined;
let type: 'cordova' | 'instance';
@@ -22,6 +32,8 @@ export function transformProperty(members: any[], index: number) {
return property;
}
const propertyName = (property.name as Identifier).text;
const getter = factory.createGetAccessorDeclaration(
undefined,
property.name,
@@ -31,7 +43,7 @@ export function transformProperty(members: any[], index: number) {
factory.createReturnStatement(
factory.createCallExpression(factory.createIdentifier(type + 'PropertyGet'), undefined, [
factory.createThis(),
factory.createStringLiteral((property.name as any).text),
factory.createStringLiteral(propertyName),
])
),
])
@@ -45,7 +57,7 @@ export function transformProperty(members: any[], index: number) {
factory.createExpressionStatement(
factory.createCallExpression(factory.createIdentifier(type + 'PropertySet'), undefined, [
factory.createThis(),
factory.createStringLiteral((property.name as any).text),
factory.createStringLiteral(propertyName),
factory.createIdentifier('value'),
])
),