mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Added definition of getMainAssets method (#43168)
Co-authored-by: Ivan Zuev <i-zuev@yandex-team.ru>
This commit is contained in:
parent
47dd795052
commit
4cf0aeeab5
5
types/loadable__server/index.d.ts
vendored
5
types/loadable__server/index.d.ts
vendored
@ -79,6 +79,11 @@ export class ChunkExtractor {
|
||||
*/
|
||||
requireEntrypoint(name?: string): { default: ComponentType };
|
||||
|
||||
/**
|
||||
* Get required assets definition
|
||||
*/
|
||||
getMainAssets(scriptType?: string): Chunk[];
|
||||
|
||||
/**
|
||||
* Get scripts as a string of `<script>` tags
|
||||
*/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import { ChunkExtractor, AttrFn } from '@loadable/server';
|
||||
import { ChunkExtractor, AttrFn, Chunk } from '@loadable/server';
|
||||
|
||||
// Should be satisfied by `stats` or `statsFile`
|
||||
new ChunkExtractor({ stats: {} });
|
||||
@ -16,7 +16,8 @@ const {
|
||||
requireEntrypoint,
|
||||
getInlineStyleTags,
|
||||
getInlineStyleElements,
|
||||
getCssString
|
||||
getCssString,
|
||||
getMainAssets
|
||||
} = new ChunkExtractor({ stats: {} });
|
||||
|
||||
// collectChunks
|
||||
@ -47,6 +48,13 @@ const attrFn: AttrFn = (chunk) => {
|
||||
};
|
||||
};
|
||||
|
||||
// getMainAssets
|
||||
{
|
||||
// should return an array of Chunk
|
||||
const assets: Chunk[] = getMainAssets();
|
||||
const typedAssets: Chunk[] = getMainAssets('script');
|
||||
}
|
||||
|
||||
// getLinkElements
|
||||
{
|
||||
// Should return an array of React elements
|
||||
|
||||
Loading…
Reference in New Issue
Block a user