Skip to content

chore: change README to add the creation of typings.d.ts #3439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 6, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,14 +358,23 @@ npm install @types/d3 --save-dev

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

// in src/app/app.component.ts
import * as typelessPackage from 'typeless-package';
typelessPackage.method();
```
1. First, create a `typings.d.ts` file in your `src/` folder. This file will be automatically included as global type definition.

2. Then, in `src/typings.d.ts`, add the following code:

```typescript
declare module 'typeless-package';
```

3. Finally, in the component or file that uses the library, add the following code:

```typescript
import * as typelessPackage from 'typeless-package';
typelessPackage.method();
```

Done. Note: you might need or find useful to define more typings for the library that you're trying to use.

### Global Library Installation

Expand Down