Skip to content

Commit 21fd8b7

Browse files
docs(readme): added types in readme
1 parent e296bcb commit 21fd8b7

File tree

1 file changed

+55
-9
lines changed

1 file changed

+55
-9
lines changed

README.md

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,19 @@ For further hints on compatibility issues, check out [Shimming](https://webpack.
2323
To begin, you'll need to install `expose-loader`:
2424

2525
```console
26-
$ npm install expose-loader --save-dev
26+
npm install expose-loader --save-dev
27+
```
28+
29+
or
30+
31+
```console
32+
yarn add -D expose-loader
33+
```
34+
35+
or
36+
37+
```console
38+
pnpm -D expose-loader
2739
```
2840

2941
(If you're using WebPack 4, install `expose-loader@1` and follow the [corresponding instructions](https://v4.webpack.js.org/loaders/expose-loader/) instead.)
@@ -115,16 +127,35 @@ And run `webpack` via your preferred method.
115127

116128
### `exposes`
117129

118-
Type: `String|Object|Array<String|Object>`
130+
Type:
131+
132+
```ts
133+
type exposes =
134+
| string
135+
| {
136+
globalName: string | Array<string>;
137+
moduleLocalName?: string;
138+
override?: boolean;
139+
}
140+
| Array<
141+
| string
142+
| {
143+
globalName: string | Array<string>;
144+
moduleLocalName?: string;
145+
override?: boolean;
146+
}
147+
>;
148+
```
149+
119150
Default: `undefined`
120151

121152
List of exposes.
122153

123-
#### `String`
154+
#### `string`
124155

125156
Allows to use a string to describe an expose.
126157

127-
##### `Syntax`
158+
##### `syntax`
128159

129160
The `|` or `%20` (space) allow to separate the `globalName`, `moduleLocalName` and `override` of expose.
130161

@@ -161,13 +192,18 @@ module.exports = {
161192
};
162193
```
163194

164-
#### `Object`
195+
#### `object`
165196

166197
Allows to use an object to describe an expose.
167198

168199
##### `globalName`
169200

170-
Type: `String|Array<String>`
201+
Type:
202+
203+
```ts
204+
type globalName = string | Array<string>;
205+
```
206+
171207
Default: `undefined`
172208

173209
The name in the global object. (**required**).
@@ -202,7 +238,12 @@ module.exports = {
202238

203239
##### `moduleLocalName`
204240

205-
Type: `String`
241+
Type:
242+
243+
```ts
244+
type moduleLocalName = string;
245+
```
246+
206247
Default: `undefined`
207248

208249
The name of method/variable/etc of the module (the module must export it).
@@ -237,7 +278,12 @@ module.exports = {
237278

238279
##### `override`
239280

240-
Type: `Boolean`
281+
Type:
282+
283+
```ts
284+
type override = boolean;
285+
```
286+
241287
Default: `false`
242288

243289
By default loader does not override the existing value in the global object, because it is unsafe.
@@ -273,7 +319,7 @@ module.exports = {
273319
};
274320
```
275321

276-
#### `Array`
322+
#### `array`
277323

278324
**src/index.js**
279325

0 commit comments

Comments
 (0)