I haven't much exp in typescript and I stuck with this problem:
- I have a stub for ExcelScript namespace, with stub classes, interfaces and methods.
- Now I need to make this thing actually work on my local machine, so I decided to use the ExcelJs library.
- Difficulties:
- they have the same named methods
- ExcelScript has methods absent in the ExcelJs
Question: what is a good way to make my ExcelScript stub a wrapper for the ExcelJs?
ExcelScript stub:
export namespace ExcelScript {
export class Workbook {
getWorksheet(indexOrName: string | number): Worksheet {
const worksheet: Worksheet = new Worksheet;
return worksheet;
}
}
export enum RangeCopyType {
values
}
export class Worksheet {
getCell(x: number, y: number): Range {
const range: Range = new Range;
return range;
}
getRange(x: number | string, y?: string): Range {
const range: Range = new Range;
return range;
}
getTables(): Table[] {
return [new Table];
}
}
export class Range {
setValue(value: string | number | boolean | Date): Range {
const range: Range = new Range;
return range;
}
copyFrom(rangge: Range, copyType: RangeCopyType): [][] {
return [[]];
}
getText(): string {
return '';
}
getTexts(): [][] {
return [[]];
}
getValue(): string | number | boolean | Date {
return '';
}
setNumberFormat(formatString: string) {
}
convertDataTypeToText() {
}
}
export class Table {
getRange(x?: string, y?: string): Range {
const range: Range = new Range;
return range;
}
getTexts(): [][] {
return [[]];
}
}
}