diff --git a/types/loadable__server/index.d.ts b/types/loadable__server/index.d.ts index 33a3366ca9..01428eea4b 100644 --- a/types/loadable__server/index.d.ts +++ b/types/loadable__server/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for @loadable/server 5.2 +// Type definitions for @loadable/server 5.8 // Project: https://github.com/smooth-code/loadable-components // Definitions by: Martynas KadiĊĦa +// Luis Herranz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -27,6 +28,24 @@ export type ChunkExtractorOptions = { stats: object; }); +/** + * Chunk that is received by the AttrFn function. + */ +export interface Chunk { + chunk: string; + filename: string; + linkType: string; + path: string; + scriptType: string; + type: string; + url: string; +} + +/** + * Used to insert attributes in the get functions. + */ +export type AttrFn = (chunk: Chunk) => {}; + /** * Used to collect chunks server-side and get them as script tags or script elements */ @@ -51,32 +70,32 @@ export class ChunkExtractor { /** * Get scripts as a string of `