-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added declaration file * added typescript * added tsconfig * use workspace ts * removed unused file * Revert "removed unused file" This reverts commit 93e5114.
- Loading branch information
Showing
5 changed files
with
128 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
type ValueOf<T> = T[keyof T]; | ||
|
||
export type Dtypes = { | ||
"<u1": { | ||
name: "uint8"; | ||
size: 8; | ||
arrayConstructor: typeof Uint8Array; | ||
}; | ||
"|u1": { | ||
name: "uint8"; | ||
size: 8; | ||
arrayConstructor: typeof Uint8Array; | ||
}; | ||
"<u2": { | ||
name: "uint16"; | ||
size: 16; | ||
arrayConstructor: typeof Uint16Array; | ||
}; | ||
"|i1": { | ||
name: "int8"; | ||
size: 8; | ||
arrayConstructor: typeof Int8Array; | ||
}; | ||
"<i2": { | ||
name: "int16"; | ||
size: 16; | ||
arrayConstructor: typeof Int16Array; | ||
}; | ||
"<u4": { | ||
name: "uint32"; | ||
size: 32; | ||
arrayConstructor: typeof Int32Array; | ||
}; | ||
"<i4": { | ||
name: "int32"; | ||
size: 32; | ||
arrayConstructor: typeof Int32Array; | ||
}; | ||
"<u8": { | ||
name: "uint64"; | ||
size: 64; | ||
arrayConstructor: typeof BigUint64Array; | ||
}; | ||
"<i8": { | ||
name: "int64"; | ||
size: 64; | ||
arrayConstructor: typeof BigInt64Array; | ||
}; | ||
"<f4": { | ||
name: "float32"; | ||
size: 32; | ||
arrayConstructor: typeof Float32Array; | ||
}; | ||
"<f8": { | ||
name: "float64"; | ||
size: 64; | ||
arrayConstructor: typeof Float64Array; | ||
}; | ||
}; | ||
|
||
export type Parsed = ValueOf<{ | ||
[K in keyof Dtypes]: { | ||
dtype: Dtypes[K]["name"]; | ||
data: InstanceType<Dtypes[K]["arrayConstructor"]>; | ||
shape: number[]; | ||
fortranOrder: boolean; | ||
}; | ||
}>; | ||
|
||
declare class npyjs { | ||
|
||
constructor(opts?: never); | ||
|
||
dtypes: Dtypes; | ||
|
||
parse(arrayBufferContents: ArrayBuffer): Parsed; | ||
|
||
load( | ||
filename: RequestInfo | URL | ArrayBuffer, | ||
callback?: (result?: Parsed) => any, | ||
fetchArgs?: RequestInit | ||
): Promise<Parsed>; | ||
} | ||
|
||
export default npyjs; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
// Change this to match your project | ||
"include": ["index.js"], | ||
"compilerOptions": { | ||
// Tells TypeScript to read JS files, as | ||
// normally they are ignored as source files | ||
"allowJs": true, | ||
// Generate d.ts files | ||
"declaration": true, | ||
// This compiler run should | ||
// only output d.ts files | ||
"emitDeclarationOnly": true, | ||
"target": "ES6" | ||
} | ||
} |