From 4717a9308fb699420931b720b2e7e756488d66b4 Mon Sep 17 00:00:00 2001 From: Arshad Kazmi Date: Mon, 4 Feb 2019 16:45:53 +0530 Subject: [PATCH] Adds info import module decleration --- README.md | 11 +++++++++++ README_SOURCE.md | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/README.md b/README.md index 964af82..9e35ec0 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,7 @@ Issues can be funded by anyone and the money will be transparently distributed t - [Recipes](#recipes) - [Baseline tsconfig.json](#baseline-tsconfigjson) - [Default and Named Module Exports](#default-and-named-module-exports) + - [Imports in Module Decleration](#imports-in-module-decleration) - [Type Augmentation for npm libraries](#type-augmentation-for-npm-libraries) - [Override type-definitions for npm libraries](#override-type-definitions-for-npm-libraries) - [FAQ](#faq) @@ -1599,6 +1600,16 @@ import Select from '@src/components/select'; [⇧ back to top](#table-of-contents) +### Imports in Module Decleration +> 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 +```ts +declare module "react-custom-scrollbars" { + import * as React from "react"; + export interface positionValues { + ... +``` +[⇧ back to top](#table-of-contents) + ### Type Augmentation for npm libraries Strategies to fix issues coming from external type-definitions files (*.d.ts) diff --git a/README_SOURCE.md b/README_SOURCE.md index 58058e3..33aa367 100644 --- a/README_SOURCE.md +++ b/README_SOURCE.md @@ -68,6 +68,7 @@ Issues can be funded by anyone and the money will be transparently distributed t - [Recipes](#recipes) - [Baseline tsconfig.json](#baseline-tsconfigjson) - [Default and Named Module Exports](#default-and-named-module-exports) + - [Imports in Module Decleration](#imports-in-module-decleration) - [Type Augmentation for npm libraries](#type-augmentation-for-npm-libraries) - [Override type-definitions for npm libraries](#override-type-definitions-for-npm-libraries) - [FAQ](#faq) @@ -623,6 +624,16 @@ import Select from '@src/components/select'; [⇧ back to top](#table-of-contents) +### Imports in Module Decleration +> 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 +```ts +declare module "react-custom-scrollbars" { + import * as React from "react"; + export interface positionValues { + ... +``` +[⇧ back to top](#table-of-contents) + ### Type Augmentation for npm libraries Strategies to fix issues coming from external type-definitions files (*.d.ts)