Skip to content

Commit 5dd0103

Browse files
committed
acrolinx edits
1 parent e71430d commit 5dd0103

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/ide/javascript-intellisense.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ TypeScript uses several sources to build up this information:
4646

4747
## IntelliSense based on type inference
4848

49-
In JavaScript, most of the time there is no explicit type information available. Luckily, it's usually fairly easy to figure out a type given the surrounding code context.
49+
In JavaScript, most of the time there's no explicit type information available. Luckily, it's usually easy to figure out a type given the surrounding code context.
5050
This process is called type inference.
5151

5252
For a variable or property, the type is typically the type of the value used to initialize it or the most recent value assignment.
@@ -61,9 +61,9 @@ nextItem; // now we know nextItem is a string
6161

6262
For a function, the return type can be inferred from the return statements.
6363

64-
For function parameters, there is currently no inference, but there are ways to work around this using JSDoc or TypeScript *.d.ts* files (see later sections).
64+
For function parameters, there's currently no inference, but there are ways to work around this using JSDoc or TypeScript *.d.ts* files (see later sections).
6565

66-
Additionally, there is special inference for the following:
66+
Additionally, there's special inference for the following:
6767

6868
- "ES3-style" classes, specified using a constructor function and assignments to the prototype property.
6969
- CommonJS-style module patterns, specified as property assignments on the `exports` object, or assignments to the `module.exports` property.
@@ -82,7 +82,7 @@ exports.Foo = Foo;
8282

8383
## IntelliSense based on JSDoc
8484

85-
Where type inference doesn't provide the desired type information (or to support documentation), type information may be provided explicitly via JSDoc annotations. For example, to give a partially declared object a specific type, you can use the `@type` tag as shown below:
85+
Where type inference doesn't provide the desired type information (or to support documentation), type information may be provided explicitly via JSDoc annotations. For example, to give a partially declared object a specific type, you can use the `@type` tag as shown here:
8686

8787
```js
8888
/**
@@ -108,7 +108,7 @@ See the JSDoc information in [Type Checking JavaScript Files](https://www.typesc
108108

109109
## IntelliSense based on TypeScript declaration files
110110

111-
Because JavaScript and TypeScript are based on the same language service, they are able to interact in a rich way. For example, JavaScript IntelliSense can be provided for values declared in a *.d.ts* file (see [TypeScript documentation](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html)), and types such as interfaces and classes declared in TypeScript are available for use as types in JSDoc comments.
111+
Because JavaScript and TypeScript are based on the same language service, they're able to interact in a rich way. For example, JavaScript IntelliSense can be provided for values declared in a *.d.ts* file (see [TypeScript documentation](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html)), and types such as interfaces and classes declared in TypeScript are available for use as types in JSDoc comments.
112112

113113
Below, we show a simple example of a TypeScript definition file providing such type information (via an interface) to a JavaScript file in the same project (using a `JSDoc` tag).
114114

@@ -121,7 +121,7 @@ In the TypeScript world, most popular JavaScript libraries have their APIs descr
121121
By default, the language service tries to detect which JavaScript libraries are in use, and then automatically download and reference the corresponding *.d.ts* file that describes the library in order to provide richer IntelliSense. The files are downloaded to a cache located under the user folder at *%LOCALAPPDATA%\Microsoft\TypeScript*.
122122

123123
> [!NOTE]
124-
> This feature is **disabled** by default if you're using a *tsconfig.json* configuration file, but may be set to enabled as outlined further below.
124+
> This feature is **disabled** by default if you're using a *tsconfig.json* configuration file, but may be set to enabled as outlined further in this section.
125125
126126
Currently, auto-detection works for dependencies downloaded from npm (by reading the *package.json* file), Bower (by reading the *bower.json* file), and for loose files in your project that match a list of roughly the top 400 most popular JavaScript libraries. For example, if you have *jquery-1.10.min.js* in your project, the file *jquery.d.ts* will be fetched and loaded in order to provide a better editing experience. This *.d.ts* file will have no impact on your project.
127127

0 commit comments

Comments
 (0)