Skip to content

Commit d61fdfa

Browse files
wip(core): type moduleCache keys (ModuleCacheId)
1 parent 4b6c63c commit d61fdfa

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/types.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ export type Cache = {
1818
}
1919

2020

21+
export type ModuleCacheId = string;
22+
23+
2124
export type AbstractPath = {
2225
toString() : string,
2326
}
@@ -75,8 +78,11 @@ export type File = {
7578
* Represents a resource.
7679
*/
7780
export type Resource = {
78-
/** 'abstract' unique id of the resource */
79-
id : string,
81+
/**
82+
* 'abstract' unique id of the resource.
83+
* This id is used as the key of the [[Options.moduleCache]]
84+
*/
85+
id : ModuleCacheId,
8086
/** file path of the resource */
8187
path : AbstractPath,
8288
/** asynchronously get the content of the resource */
@@ -143,7 +149,7 @@ export type Options = {
143149
* ```
144150
*
145151
*/
146-
moduleCache?: Record<string, LoadingType<ModuleExport> | ModuleExport>,
152+
moduleCache?: Record<ModuleCacheId, LoadingType<ModuleExport> | ModuleExport>,
147153

148154

149155
/**

0 commit comments

Comments
 (0)