Skip to content

Commit 857d9fd

Browse files
arshadkazmi42piotrwitek
authored andcommitted
Adds info import module decleration (piotrwitek#134)
FIxes piotrwitek#63 - Related to piotrwitek#130
1 parent bdec1e5 commit 857d9fd

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Issues can be funded by anyone and the money will be transparently distributed t
6868
- [Recipes](#recipes)
6969
- [Baseline tsconfig.json](#baseline-tsconfigjson)
7070
- [Default and Named Module Exports](#default-and-named-module-exports)
71+
- [Imports in Module Decleration](#imports-in-module-decleration)
7172
- [Type Augmentation for npm libraries](#type-augmentation-for-npm-libraries)
7273
- [Override type-definitions for npm libraries](#override-type-definitions-for-npm-libraries)
7374
- [FAQ](#faq)
@@ -1599,6 +1600,16 @@ import Select from '@src/components/select';
15991600
16001601
[⇧ back to top](#table-of-contents)
16011602
1603+
### Imports in Module Decleration
1604+
> When creating 3rd party modules declarations all the imports should be put inside the module decleration, otherwise it will be treated as augmentation and show error
1605+
```ts
1606+
declare module "react-custom-scrollbars" {
1607+
import * as React from "react";
1608+
export interface positionValues {
1609+
...
1610+
```
1611+
[⇧ back to top](#table-of-contents)
1612+
16021613
### Type Augmentation for npm libraries
16031614
Strategies to fix issues coming from external type-definitions files (*.d.ts)
16041615

README_SOURCE.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Issues can be funded by anyone and the money will be transparently distributed t
6868
- [Recipes](#recipes)
6969
- [Baseline tsconfig.json](#baseline-tsconfigjson)
7070
- [Default and Named Module Exports](#default-and-named-module-exports)
71+
- [Imports in Module Decleration](#imports-in-module-decleration)
7172
- [Type Augmentation for npm libraries](#type-augmentation-for-npm-libraries)
7273
- [Override type-definitions for npm libraries](#override-type-definitions-for-npm-libraries)
7374
- [FAQ](#faq)
@@ -623,6 +624,16 @@ import Select from '@src/components/select';
623624
624625
[⇧ back to top](#table-of-contents)
625626
627+
### Imports in Module Decleration
628+
> When creating 3rd party modules declarations all the imports should be put inside the module decleration, otherwise it will be treated as augmentation and show error
629+
```ts
630+
declare module "react-custom-scrollbars" {
631+
import * as React from "react";
632+
export interface positionValues {
633+
...
634+
```
635+
[⇧ back to top](#table-of-contents)
636+
626637
### Type Augmentation for npm libraries
627638
Strategies to fix issues coming from external type-definitions files (*.d.ts)
628639

0 commit comments

Comments
 (0)