Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions KaitaiStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1040,8 +1040,6 @@ namespace KaitaiStream {
*/
public constructor(bytesReq: number, bytesAvail: number) {
super("requested " + bytesReq + " bytes, but only " + bytesAvail + " bytes available");
// Workaround https://www.typescriptlang.org/docs/handbook/2/classes.html#inheriting-built-in-types
Object.setPrototypeOf(this, KaitaiStream.EOFError.prototype);
this.bytesReq = bytesReq;
this.bytesAvail = bytesAvail;
}
Expand All @@ -1061,8 +1059,6 @@ namespace KaitaiStream {
*/
public constructor(expected: any, actual: any) {
super("expected [" + expected + "], but got [" + actual + "]");
// Workaround https://www.typescriptlang.org/docs/handbook/2/classes.html#inheriting-built-in-types
Object.setPrototypeOf(this, KaitaiStream.UnexpectedDataError.prototype);
this.expected = expected;
this.actual = actual;
}
Expand All @@ -1073,8 +1069,6 @@ namespace KaitaiStream {

public constructor() {
super();
// Workaround https://www.typescriptlang.org/docs/handbook/2/classes.html#inheriting-built-in-types
Object.setPrototypeOf(this, KaitaiStream.UndecidedEndiannessError.prototype);
}
};

Expand All @@ -1089,8 +1083,6 @@ namespace KaitaiStream {
*/
public constructor(expected: any, actual: any) {
super("not equal, expected [" + expected + "], but got [" + actual + "]");
// Workaround https://www.typescriptlang.org/docs/handbook/2/classes.html#inheriting-built-in-types
Object.setPrototypeOf(this, KaitaiStream.ValidationNotEqualError.prototype);
this.expected = expected;
this.actual = actual;
}
Expand All @@ -1107,8 +1099,6 @@ namespace KaitaiStream {
*/
public constructor(min: any, actual: any) {
super("not in range, min [" + min + "], but got [" + actual + "]");
// Workaround https://www.typescriptlang.org/docs/handbook/2/classes.html#inheriting-built-in-types
Object.setPrototypeOf(this, KaitaiStream.ValidationLessThanError.prototype);
this.min = min;
this.actual = actual;
}
Expand All @@ -1125,8 +1115,6 @@ namespace KaitaiStream {
*/
public constructor(max: any, actual: any) {
super("not in range, max [" + max + "], but got [" + actual + "]");
// Workaround https://www.typescriptlang.org/docs/handbook/2/classes.html#inheriting-built-in-types
Object.setPrototypeOf(this, KaitaiStream.ValidationGreaterThanError.prototype);
this.max = max;
this.actual = actual;
}
Expand All @@ -1141,8 +1129,6 @@ namespace KaitaiStream {
*/
public constructor(actual: any) {
super("not any of the list, got [" + actual + "]");
// Workaround https://www.typescriptlang.org/docs/handbook/2/classes.html#inheriting-built-in-types
Object.setPrototypeOf(this, KaitaiStream.ValidationNotAnyOfError.prototype);
this.actual = actual;
}
};
Expand All @@ -1156,8 +1142,6 @@ namespace KaitaiStream {
*/
public constructor(actual: any) {
super("not in the enum, got [" + actual + "]");
// Workaround https://www.typescriptlang.org/docs/handbook/2/classes.html#inheriting-built-in-types
Object.setPrototypeOf(this, KaitaiStream.ValidationNotInEnumError.prototype);
this.actual = actual;
}
};
Expand All @@ -1171,8 +1155,6 @@ namespace KaitaiStream {
*/
public constructor(actual: any) {
super("not matching the expression, got [" + actual + "]");
// Workaround https://www.typescriptlang.org/docs/handbook/2/classes.html#inheriting-built-in-types
Object.setPrototypeOf(this, KaitaiStream.ValidationExprError.prototype);
this.actual = actual;
}
};
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
"@types/node": "^24.12.0",
"rollup": "^4.59.0",
"tslib": "^2.8.1",
"typescript": "^5.9.3"
"typescript": "^6.0.3"
}
}
10 changes: 5 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */

/* Language and Environment */
"target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"target": "es6", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
// "libReplacement": true, /* Enable lib replacement. */
Expand All @@ -26,14 +26,14 @@
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */

/* Modules */
"module": "es2015", /* Specify what module code is generated. */
// "rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
"module": "preserve", /* Specify what module code is generated. */
"rootDir": "./", /* Specify the root folder within your source files. */
"moduleResolution": "bundler", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
"types": ["node"], /* Specify type package names to be included without being referenced in a source file. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
Expand Down