Skip to content

Commit 0365118

Browse files
authored
chore: change README to add the creation of typings.d.ts (#3439)
1 parent 96852ed commit 0365118

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

README.md

+16-7
Original file line numberDiff line numberDiff line change
@@ -358,14 +358,23 @@ npm install @types/d3 --save-dev
358358

359359
If the library doesn't have typings available at `@types/`, you can still use it by
360360
manually adding typings for it:
361-
```
362-
// in src/typings.d.ts
363-
declare module 'typeless-package';
364361

365-
// in src/app/app.component.ts
366-
import * as typelessPackage from 'typeless-package';
367-
typelessPackage.method();
368-
```
362+
1. First, create a `typings.d.ts` file in your `src/` folder. This file will be automatically included as global type definition.
363+
364+
2. Then, in `src/typings.d.ts`, add the following code:
365+
366+
```typescript
367+
declare module 'typeless-package';
368+
```
369+
370+
3. Finally, in the component or file that uses the library, add the following code:
371+
372+
```typescript
373+
import * as typelessPackage from 'typeless-package';
374+
typelessPackage.method();
375+
```
376+
377+
Done. Note: you might need or find useful to define more typings for the library that you're trying to use.
369378

370379
### Global Library Installation
371380

0 commit comments

Comments
 (0)