I was going through one of the repo to see how people structure their ts repo.
I went through their typings and saw this
/**
* react-native-extensions.d.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
*
* Type definition file that extends the public React Native type definition file.
*/
import * as React from 'react';
import * as RN from 'react-native';
import * as RNW from 'react-native-windows';
declare module 'react-native' {
interface ExtendedViewProps extends RN.ViewProps
{
Now, I am unable to figure out when should we use declare module
or declare namespace
? The closest I was able to come across with this answer on stackoverflow but I think this shares the difference between the both and not when to use them (and which one to use)
The typescript handbook states this
This post outlines the various ways to organize your code using modules and namespaces in TypeScrip
And I wasn't able to comprehend the definition of the above.