What I do is set up a file called aaa.d.ts that contains type definitions for all my additional prototype functions.
interface CreepMemory {
task?: string;
bodyType?: string;
home?: string;
storage?: string;
working?: true;
waypoint?: number;
}
interface BodyType {
parts: BodyPartConstant[];
create(amount: number): BodyPartConstant[];
}
interface LegacyTaskType<T> {
body: string;
canPerform(creep: Creep, target: T, running: boolean): boolean;
spawnWeight: number;
color: string;
perform(creep: Creep, target: T): ScreepsReturnCode;
heals?: boolean;
}
interface Room {
creepTypes?: Record<string, number>;
targetCreepTypes?: Record<string, number>;
unassignedPoint?: RoomPosition;
}
interface StructureLink {
receiving?: boolean;
sent?: boolean;
}
interface Creep {
moveColor?: string;
task?: any;
}
interface Console {
log(value: any, ...extra: any[]): void;
commandResult(message: any): void;
}
declare namespace NodeJS {
interface Global extends Record<string, any> {
FIND_TOMBSTONES?: FIND_TOMBSTONES; // Workaround for PTR bug - probably fixed by now
}
}