Skip to content

Commit 9c7f18f

Browse files
WANGXIAOBO558WANGXIAOBO558
WANGXIAOBO558
authored and
WANGXIAOBO558
committed
rename 'globals.d.ts' to 'global.d.ts'
1 parent 5fe933c commit 9c7f18f

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

SUMMARY.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* [Declaration Spaces](docs/project/declarationspaces.md)
3333
* [Modules](docs/project/modules.md)
3434
* [File Module Details](docs/project/external-modules.md)
35-
* [globals.d.ts](docs/project/globals.md)
35+
* [global.d.ts](docs/project/globals.md)
3636
* [Namespaces](docs/project/namespaces.md)
3737
* [Dynamic Import Expressions](docs/project/dynamic-import-expressions.md)
3838
* [Node.js QuickStart](docs/quick/nodejs.md)

docs/project/external-modules.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ You can declare a module *globally* for your project by using `declare module 's
179179

180180
e.g.
181181
```ts
182-
// globals.d.ts
182+
// global.d.ts
183183
declare module 'foo' {
184184
// Some variable declarations
185185
export var bar: number; /*sample*/

docs/project/globals.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# globals.d.ts
1+
# global.d.ts
22

33
We discussed *global* vs. *file* modules when covering [projects](./modules.md) and recommended using file based modules and not polluting the global namespace.
44

5-
Nevertheless, if you have beginning TypeScript developers you can give them a `globals.d.ts` file to put interfaces / types in the global namespace to make it easy to have some *types* just *magically* available for consumption in *all* your TypeScript code.
5+
Nevertheless, if you have beginning TypeScript developers you can give them a `global.d.ts` file to put interfaces / types in the global namespace to make it easy to have some *types* just *magically* available for consumption in *all* your TypeScript code.
66

77
> For any code that is going to generate *JavaScript* we highly recommend using *file modules*.
88
9-
* `globals.d.ts` is great for adding extensions to `lib.d.ts` if you need to.
9+
* `global.d.ts` is great for adding extensions to `lib.d.ts` if you need to.
1010
* It's good for quick `declare module "some-library-you-dont-care-to-get-defs-for";` when doing JS to TS migrations.

docs/types/ambient/d.ts.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ declare var foo: any;
1010
foo = 123; // allowed
1111
```
1212

13-
You have the option of putting these declarations in a `.ts` file or in a `.d.ts` file. We highly recommend that in your real world projects you use a separate `.d.ts` (start with one called something like `globals.d.ts` or `vendor.d.ts`).
13+
You have the option of putting these declarations in a `.ts` file or in a `.d.ts` file. We highly recommend that in your real world projects you use a separate `.d.ts` (start with one called something like `global.d.ts` or `vendor.d.ts`).
1414

1515
If a file has the extension `.d.ts` then each root level definition must have the `declare` keyword prefixed to it. This helps make it clear to the author that there will be *no code emitted by TypeScript*. The author needs to ensure that the declared item will exist at runtime.
1616

docs/types/lib.d.ts.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ There is a good reason for using *interfaces* for these globals. It allows you t
6262

6363
### Modifying Native Types
6464

65-
Since an `interface` in TypeScript is open ended this means that you can just add members to the interfaces declared in `lib.d.ts` and TypeScript will pick up on the additions. Note that you need to make these changes in a [*global module*](../project/modules.md) for these interfaces to be associated with `lib.d.ts`. We even recommend creating a special file called [`globals.d.ts`](../project/globals.md) for this purpose.
65+
Since an `interface` in TypeScript is open ended this means that you can just add members to the interfaces declared in `lib.d.ts` and TypeScript will pick up on the additions. Note that you need to make these changes in a [*global module*](../project/modules.md) for these interfaces to be associated with `lib.d.ts`. We even recommend creating a special file called [`global.d.ts`](../project/globals.md) for this purpose.
6666

6767
Here are a few example cases where we add stuff to `window`, `Math`, `Date`:
6868

docs/types/migrating.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ import * as $ from "jquery";
9898
9999
# External non js resources
100100

101-
You can even allow import of any file e.g. `.css` files (if you are using something like webpack style loaders or css modules) with a simple `*` style declaration (ideally in a [`globals.d.ts` file](../project/globals.md)):
101+
You can even allow import of any file e.g. `.css` files (if you are using something like webpack style loaders or css modules) with a simple `*` style declaration (ideally in a [`global.d.ts` file](../project/globals.md)):
102102

103103
```ts
104104
declare module "*.css";

0 commit comments

Comments
 (0)