config2ts 2.5.1 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -61,11 +61,11 @@ export const ASSETS = {
61
61
  image: {
62
62
  adjustHorizontal: {path:'public/image/adjust-horizontal.png',type:'png'},
63
63
  direction: {path:'public/image/direction.png',type:'png'}
64
- } as Record<string, PngAsset>,
64
+ } satisfies Record<string, PngAsset>,
65
65
  music: {
66
66
  effect1: {path:'public/music/effect1.mp3',type:'mp3'},
67
67
  effect2: {path:'public/music/effect2.mp3',type:'mp3'}
68
- } as Record<string, Mp3Asset>,
68
+ } satisfies Record<string, Mp3Asset>,
69
69
  singleFile: {
70
70
  effect1: {path:'public/single-file/effect1.mp3',type:'mp3'}
71
71
  }
package/lib/config2ts.js CHANGED
@@ -411,7 +411,7 @@ function serializeAssetNode(node, indent, uniformDirs, extTypeMap) {
411
411
  }
412
412
  else {
413
413
  const childUt = uniformDirs.get(value);
414
- const typeAnnotation = childUt ? ` as Record<string, ${extTypeMap.get(childUt)}>` : "";
414
+ const typeAnnotation = childUt ? ` satisfies Record<string, ${extTypeMap.get(childUt)}>` : "";
415
415
  lines.push(`${indent}${serializedKey}: {`);
416
416
  lines.push(serializeAssetNode(value, indent + " ", uniformDirs, extTypeMap));
417
417
  lines.push(`${indent}}${typeAnnotation}${comma}`);
@@ -447,7 +447,7 @@ function assets2ts(assetsDir) {
447
447
  const rootUt = uniformDirs.get(root);
448
448
  template += ` ${dirName}: {\n`;
449
449
  template += serializeAssetNode(root, " ", uniformDirs, extTypeMap);
450
- const rootAnnotation = rootUt ? ` as Record<string, ${extTypeMap.get(rootUt)}>` : "";
450
+ const rootAnnotation = rootUt ? ` satisfies Record<string, ${extTypeMap.get(rootUt)}>` : "";
451
451
  template += `\n }${rootAnnotation}\n`;
452
452
  template += `};\n`;
453
453
  return template;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "config2ts",
3
- "version": "2.5.1",
3
+ "version": "2.5.2",
4
4
  "description": "convert config to ts file.",
5
5
  "main": "lib/config2ts.js",
6
6
  "types": "lib/config2ts.d.ts",