@aidc-toolkit/dev 0.9.19-beta → 0.9.21-beta
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 +1 -1
- package/config/publish.json +51 -19
- package/copy-workflows.json +4 -0
- package/dev.iml +3 -1
- package/dist/eslint-config-template.d.ts.map +1 -1
- package/dist/eslint-config-template.js +1 -0
- package/dist/eslint-config-template.js.map +1 -1
- package/package.json +3 -3
- package/src/eslint-config-template.ts +1 -0
- package/src/publish/configuration.ts +318 -0
- package/src/publish/logger.ts +18 -7
- package/src/publish/publish-alpha.ts +54 -27
- package/src/publish/publish-beta.ts +96 -28
- package/src/publish/publish.ts +341 -377
- package/src/publish/type-helper.ts +23 -0
|
@@ -49,3 +49,26 @@ export function omit<T extends object, K extends keyof T>(o: T, ...keys: K[]): O
|
|
|
49
49
|
export function pick<T extends object, K extends keyof T>(o: T, ...keys: K[]): Pick<T, K> {
|
|
50
50
|
return omitOrPick(false, o, ...keys);
|
|
51
51
|
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Cast a property as a more narrow type.
|
|
55
|
+
*
|
|
56
|
+
* @param o
|
|
57
|
+
* Object.
|
|
58
|
+
*
|
|
59
|
+
* @param key
|
|
60
|
+
* Key of property to cast.
|
|
61
|
+
*
|
|
62
|
+
* @returns
|
|
63
|
+
* Single-key object with property cast as desired type.
|
|
64
|
+
*/
|
|
65
|
+
export function propertyAs<TAsType extends T[K], T extends object, K extends keyof T>(o: T, key: K): Readonly<Omit<T, K> extends T ? Partial<Record<K, TAsType>> : Record<K, TAsType>> {
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Type is determined by condition.
|
|
67
|
+
return (key in o ?
|
|
68
|
+
{
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Force cast.
|
|
70
|
+
[key]: o[key] as TAsType
|
|
71
|
+
} :
|
|
72
|
+
{}
|
|
73
|
+
) as ReturnType<typeof propertyAs<TAsType, T, K>>;
|
|
74
|
+
}
|