@@ -3,28 +3,28 @@ import type { gguf } from "./gguf";
3
3
import type { GGUFMetadata , GGUFParseOutput , GGUFType } from "./types" ;
4
4
5
5
describe ( "gguf-types" , ( ) => {
6
- it ( "gguf() type can be casted (at compile time)" , async ( ) => {
6
+ it ( "gguf() type can be casted between STRICT and NON_STRICT (at compile time)" , async ( ) => {
7
7
// eslint-disable-next-line @typescript-eslint/no-explicit-any
8
8
const result : Awaited < ReturnType < typeof gguf > > = null as any ;
9
- const strictType = result as GGUFParseOutput < GGUFType . strict > ;
9
+ const strictType = result as GGUFParseOutput < GGUFType . STRICT > ;
10
10
// @ts -expect-error because the key "abc" does not exist
11
11
strictType . metadata . abc = 123 ;
12
- const nonStrictType = result as GGUFParseOutput < GGUFType . nonStrict > ;
12
+ const nonStrictType = result as GGUFParseOutput < GGUFType . NON_STRICT > ;
13
13
nonStrictType . metadata . abc = 123 ; // PASS, because it can be anything
14
14
// @ts -expect-error because ArrayBuffer is not a MetadataValue
15
15
nonStrictType . metadata . fff = ArrayBuffer ;
16
16
} ) ;
17
17
18
- it ( "GGUFType.nonStrict should be correct (at compile time)" , async ( ) => {
18
+ it ( "GGUFType.NON_STRICT should be correct (at compile time)" , async ( ) => {
19
19
// eslint-disable-next-line @typescript-eslint/no-explicit-any
20
- const model : GGUFMetadata < GGUFType . nonStrict > = null as any ;
20
+ const model : GGUFMetadata < GGUFType . NON_STRICT > = null as any ;
21
21
model . kv_count = 123n ;
22
22
model . abc = 456 ; // PASS, because it can be anything
23
23
} ) ;
24
24
25
- it ( "GGUFType.strict should be correct (at compile time)" , async ( ) => {
25
+ it ( "GGUFType.STRICT should be correct (at compile time)" , async ( ) => {
26
26
// eslint-disable-next-line @typescript-eslint/no-explicit-any
27
- const model : GGUFMetadata < GGUFType . strict > = null as any ;
27
+ const model : GGUFMetadata < GGUFType . STRICT > = null as any ;
28
28
29
29
if ( model [ "general.architecture" ] === "whisper" ) {
30
30
model [ "encoder.whisper.block_count" ] = 0 ;
0 commit comments