Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo in TypeScript 2.2.md #3033

Open
wants to merge 17 commits into
base: v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ This is now the default for MSBuild projects; this allows MSBuild incremental bu

## AMD Module names

By default AMD modules are generated anonymous. This can lead to problems when other tools are used to process the resulting modules like a bundlers (e.g. `r.js`).
By default AMD modules are generated anonymous. This can lead to problems when other tools are used to process the resulting modules like bundlers (e.g. `r.js`).

The new `amd-module name` tag allows passing an optional module name to the compiler:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ TypeScript will emit the string in ES3/ES5 as `"\uD842\uDFB7"`.
## Tagged template strings in ES3/ES5

In TypeScript 1.4, we added support for template strings for all targets, and tagged templates for just ES6.
Thanks to some considerable work done by [@ivogabe](https://github.com/ivogabe), we bridged the gap for for tagged templates in ES3 and ES5.
Thanks to some considerable work done by [@ivogabe](https://github.com/ivogabe), we bridged the gap for tagged templates in ES3 and ES5.

When targeting ES3/ES5, the following code

Expand Down Expand Up @@ -320,7 +320,7 @@ var _a;

## AMD-dependency optional names

`/// <amd-dependency path="x" />` informs the compiler about a non-TS module dependency that needs to be injected in the resulting module's require call;
`/// <amd-dependency path="x" />` informs the compiler about a non-TS module dependency that needs to be injected in the resulting module's required call;
however, there was no way to consume this module in the TS code.

The new `amd-dependency name` property allows passing an optional name for an amd-dependency:
Expand Down Expand Up @@ -380,7 +380,7 @@ Now if a new file `FolderA\3.ts` is added to the input, the output structure wil

The TypeScript compiler emits a few helpers like `__extends` when needed.
The helpers are emitted in every file they are referenced in.
If you want to consolidate all helpers in one place, or override the default behavior, use [`noEmitHelpers`](/tsconfig#noEmitHelpers) to instructs the compiler not to emit them.
If you want to consolidate all helpers in one place, or override the default behavior, use [`noEmitHelpers`](/tsconfig#noEmitHelpers) to instruct the compiler not to emit them.

## `--newLine` command line option

Expand All @@ -389,5 +389,5 @@ By default the output new line character is `\r\n` on Windows based systems and

## `--inlineSourceMap` and `inlineSources` command line options

[`inlineSourceMap`](/tsconfig#inlineSourceMap) causes source map files to be written inline in the generated `.js` files instead of in a independent `.js.map` file.
[`inlineSourceMap`](/tsconfig#inlineSourceMap) causes source map files to be written inline in the generated `.js` files instead of in an independent `.js.map` file.
[`inlineSources`](/tsconfig#inlineSources) allows for additionally inlining the source `.ts` file into the `.js` file.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const Greeter = ({ name = "world" }) => <div>Hello, {name}!</div>;
let example = <Greeter name="TypeScript 1.8" />;
```

For this feature and simplified props, be sure to be use the [latest version of react.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts).
For this feature and simplified props, be sure to use the [latest version of react.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts).

## Simplified `props` type management in React

Expand Down Expand Up @@ -351,7 +351,7 @@ define("a", ["require", "exports", "lib/b"], function (require, exports, B) {

## Support for `default` import interop with SystemJS

Module loaders like SystemJS wrap CommonJS modules and expose then as a `default` ES6 import. This makes it impossible to share the definition files between the SystemJS and CommonJS implementation of the module as the module shape looks different based on the loader.
Module loaders like SystemJS wrap CommonJS modules and expose them as a `default` ES6 import. This makes it impossible to share the definition files between the SystemJS and CommonJS implementation of the module as the module shape looks different based on the loader.

Setting the new compiler flag [`allowSyntheticDefaultImports`](/tsconfig#allowSyntheticDefaultImports) indicates that the module loader performs some kind of synthetic default import member creation not indicated in the imported .ts or .d.ts. The compiler will infer the existence of a `default` export that has the shape of the entire module itself.

Expand Down Expand Up @@ -524,7 +524,7 @@ Also, a nightly NuGet package to match the [nightly npm package](http://blogs.ms
We understand that a ton of monochrome output can be a little difficult on the eyes.
Colors can help discern where a message starts and ends, and these visual clues are important when error output gets overwhelming.

By just passing the [`pretty`](/tsconfig#pretty) command line option, TypeScript gives more colorful output with context about where things are going wrong.
By just passing the [`pretty`](/tsconfig#pretty) command line option, TypeScript gives a more colorful output with context about where things are going wrong.

![Showing off pretty error messages in ConEmu](https://raw.githubusercontent.com/wiki/Microsoft/TypeScript/images/new-in-typescript/pretty01.png)

Expand Down
10 changes: 5 additions & 5 deletions packages/documentation/copy/en/release-notes/TypeScript 2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ The effects on subject variable types accurately reflect JavaScript semantics (e
## Dotted names in type guards

Type guards previously only supported checking local variables and parameters.
Type guards now support checking "dotted names" consisting of a variable or parameter name followed one or more property accesses.
Type guards now support checking "dotted names" consisting of a variable or parameter name followed by one or more property accesses.

##### Example

Expand Down Expand Up @@ -478,7 +478,7 @@ A new flag is also added in TypeScript 2.0 to flag all uses of `this` in functio

Glob support is here!! Glob support has been [one of the most requested features](https://github.com/Microsoft/TypeScript/issues/1927).

Glob-like file patterns are supported two properties [`include`](/tsconfig#include) and [`exclude`](/tsconfig#exclude).
Glob-like file patterns are supported by two properties [`include`](/tsconfig#include) and [`exclude`](/tsconfig#exclude).

##### Example

Expand Down Expand Up @@ -562,7 +562,7 @@ For instance, an import to a module `"jquery"` would be translated at runtime to
}
```

Using [`paths`](/tsconfig#paths) also allow for more sophisticated mappings including multiple fall back locations.
Using [`paths`](/tsconfig#paths) also allows for more sophisticated mappings including multiple fall back locations.
Consider a project configuration where only some modules are available in one location, and the rest are in another.

## Virtual Directories with `rootDirs`
Expand Down Expand Up @@ -627,7 +627,7 @@ x(y);

## Wildcard character in module names

Importing none-code resources using module loaders extension (e.g. [AMD](https://github.com/amdjs/amdjs-api/blob/master/LoaderPlugins.md) or [SystemJS](https://github.com/systemjs/systemjs/blob/main/docs/module-types.md)) has not been easy before;
Importing non-code resources using module loaders extension (e.g. [AMD](https://github.com/amdjs/amdjs-api/blob/master/LoaderPlugins.md) or [SystemJS](https://github.com/systemjs/systemjs/blob/main/docs/module-types.md)) has not been easy before;
previously an ambient module declaration had to be defined for each resource.

TypeScript 2.0 supports the use of the wildcard character (`*`) to declare a "family" of module names;
Expand Down Expand Up @@ -741,7 +741,7 @@ function test(x: Bar) {
## Private and Protected Constructors

A class constructor may be marked `private` or `protected`.
A class with private constructor cannot be instantiated outside the class body, and cannot be extended.
A class with a private constructor cannot be instantiated outside the class body, and cannot be extended.
A class with protected constructor cannot be instantiated outside the class body, but can be extended.
eugeneilyin marked this conversation as resolved.
Show resolved Hide resolved

##### Example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ TypeScript 2.1 supports inheriting configuration using `extends`, where:

- `extends` is a new top-level property in `tsconfig.json` (alongside `compilerOptions`, [`files`](/tsconfig#files), [`include`](/tsconfig#include), and [`exclude`](/tsconfig#exclude)).
- The value of `extends` must be a string containing a path to another configuration file to inherit from.
- The configuration from the base file are loaded first, then overridden by those in the inheriting config file.
- The configuration from the base file is loaded first, then overridden by those in the inheriting config file.
- Circularity between configuration files is not allowed.
- [`files`](/tsconfig#files), [`include`](/tsconfig#include), and [`exclude`](/tsconfig#exclude) from the inheriting config file _overwrite_ those from the base config file.
- All relative paths found in the configuration file will be resolved relative to the configuration file they originated in.
Expand Down
10 changes: 5 additions & 5 deletions packages/documentation/copy/en/release-notes/TypeScript 2.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ TypeScript 2.2 improves checking of nullable operands in expressions. Specifical
- If the operand of a `+`, `-`, `~`, `++`, or `--` unary operator is nullable.

An operand is considered nullable if the type of the operand is `null` or `undefined` or a union type that includes `null` or `undefined`.
Note that the union type case only only occurs in [`strictNullChecks`](/tsconfig#strictNullChecks) mode because `null` and `undefined` disappear from unions in classic type checking mode.
Note that the union type case only occurs in [`strictNullChecks`](/tsconfig#strictNullChecks) mode because `null` and `undefined` disappear from unions in classic type checking mode.

## Dotted property for types with string index signatures

Expand All @@ -180,12 +180,12 @@ map["prop1"] = 1;
map.prop2 = 2;
```

This only apply to types with an _explicit_ string index signature.
This only applies to types with an _explicit_ string index signature.
It is still an error to access unknown properties on a type using `.` notation.

## Support for spread operator on JSX element children

TypeScript 2.2 adds support for using spread on a JSX element children.
TypeScript 2.2 adds support for using spread on JSX element children.
Please see [facebook/jsx#57](https://github.com/facebook/jsx/issues/57) for more details.

##### Example
Expand All @@ -208,5 +208,5 @@ let x: TodoListProps;

## New `jsx: react-native`

React-native build pipeline expects all files to have a `.js` extensions even if the file contains JSX syntax.
The new [`jsx`](/tsconfig#jsx) value `react-native` will persevere the JSX syntax in the output file, but give it a `.js` extension.
React-native build pipeline expects all files to have a `.js` extension even if the file contains JSX syntax.
The new [`jsx`](/tsconfig#jsx) value `react-native` will preserve the JSX syntax in the output file, but give it a `.js` extension.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ var result = templateObjectFactory() === templateObjectFactory();
## Localized diagnostics on the command line

TypeScript 2.6 npm package ships with localized versions of diagnostic messages for 13 languages.
The localized messages are available when using `--locale` flag on the command line.
The localized messages are available when using the `--locale` flag on the command line.

##### Example

Expand Down Expand Up @@ -214,7 +214,7 @@ wn' 'es2016.array.include' 'es2017.object' 'es2017.sharedmemory' 'es2017.string'

## Suppress errors in .ts files using '// @ts-ignore' comments

TypeScript 2.6 support suppressing errors in .ts files using `// @ts-ignore` comments placed above the offending lines.
TypeScript 2.6 supports suppressing errors in .ts files using `// @ts-ignore` comments placed above the offending lines.

##### Example

Expand All @@ -235,7 +235,7 @@ Please note that this comment only suppresses the error reporting, and we recomm
TypeScript 2.6 brings a faster `--watch` implementation.
The new version optimizes code generation and checking for code bases using ES modules.
Changes detected in a module file will result in _only_ regenerating the changed module, and files that depend on it, instead of the whole project.
Projects with large number of files should reap the most benefit from this change.
Projects with a large number of files should reap the most benefit from this change.

The new implementation also brings performance enhancements to watching in tsserver.
The watcher logic has been completely rewritten to respond faster to change events.
Expand All @@ -247,7 +247,7 @@ Declarations are only written to but never read from are now flagged as unused.

##### Example

Bellow both `n` and `m` will be marked as unused, because their values are never _read_. Previously TypeScript would only check whether their values were _referenced_.
Below both `n` and `m` will be marked as unused, because their values are never _read_. Previously TypeScript would only check whether their values were _referenced_.

```ts
function f(n: number) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ type T24 = InstanceType<Function>; // Error

## Improved control over mapped type modifiers

Mapped types support adding a `readonly` or `?` modifier to a mapped property, but they did not provide support the ability to _remove_ modifiers.
Mapped types support adding a `readonly` or `?` modifier to a mapped property, but they did not provide support for the ability to _remove_ modifiers.
This matters in [_homomorphic mapped types_](https://github.com/Microsoft/TypeScript/pull/12563) which by default preserve the modifiers of the underlying type.

TypeScript 2.8 adds the ability for a mapped type to either add or remove a particular modifier.
Expand Down Expand Up @@ -328,7 +328,7 @@ type T7 = T4<A, B>; // "a" | "b"
## Better handling for namespace patterns in `.js` files

TypeScript 2.8 adds support for understanding more namespace patterns in `.js` files.
Empty object literals declarations on top level, just like functions and classes, are now recognized as as namespace declarations in JavaScript.
Empty object literals declarations on top level, just like functions and classes, are now recognized as namespace declarations in JavaScript.

```js
var ns = {}; // recognized as a declaration for a namespace `ns`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ TypeScript adds a new triple-slash-reference directive (`/// <reference lib="nam

Built-in _lib_ files are referenced in the same fashion as the [`lib`](/tsconfig#lib) compiler option in _tsconfig.json_ (e.g. use `lib="es2015"` and not `lib="lib.es2015.d.ts"`, etc.).

For declaration file authors who relay on built-in types, e.g. DOM APIs or built-in JS run-time constructors like `Symbol` or `Iterable`, triple-slash-reference lib directives are the recommended. Previously these .d.ts files had to add forward/duplicate declarations of such types.
For declaration file authors who rely on built-in types, e.g. DOM APIs or built-in JS run-time constructors like `Symbol` or `Iterable`, triple-slash-reference lib directives are recommended. Previously these .d.ts files had to add forward/duplicate declarations of such types.

##### Example

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const thing: Point | Label = {
};
```

Previously, a non-disciminated union wouldn't have _any_ excess property checking done on its members, and as a result, the incorrectly typed `name` property slipped by.
Previously, a non-discriminated union wouldn't have _any_ excess property checking done on its members, and as a result, the incorrectly typed `name` property slipped by.

In TypeScript 3.5, the type-checker at least verifies that all the provided properties belong to _some_ union member and have the appropriate type, meaning that the sample above correctly issues an error.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ For details, [read up more on the pull request](https://github.com/microsoft/Typ

## `--incremental` with `--noEmit`

TypeScript 4.0 allows us to use the [`noEmit`](/tsconfig#noEmit) flag when while still leveraging [`incremental`](/tsconfig#incremental) compiles.
TypeScript 4.0 allows us to use the [`noEmit`](/tsconfig#noEmit) flag while still leveraging [`incremental`](/tsconfig#incremental) compiles.
This was previously not allowed, as [`incremental`](/tsconfig#incremental) needs to emit a `.tsbuildinfo` files; however, the use-case to enable faster incremental builds is important enough to enable for all users.

For more details, you can [see the implementing pull request](https://github.com/microsoft/TypeScript/pull/39122).
Expand Down Expand Up @@ -604,7 +604,7 @@ For more details, [check out the pull request for this feature](https://github.c

TypeScript's editing support now recognizes when a declaration has been marked with a `/** @deprecated */` JSDoc comment.
That information is surfaced in completion lists and as a suggestion diagnostic that editors can handle specially.
In an editor like VS Code, deprecated values are typically displayed a strike-though style ~~like this~~.
In an editor like VS Code, deprecated values are typically displayed in a strike-though style ~~like this~~.

![Some examples of deprecated declarations with strikethrough text in the editor](https://devblogs.microsoft.com/typescript/wp-content/uploads/sites/11/2020/06/deprecated_4-0.png)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type Options = {
// };
```

But there's another place that that string literal types could be used as building blocks: building other string literal types.
But there's another place that string literal types could be used as building blocks: building other string literal types.

That's why TypeScript 4.1 brings the template literal string type.
It has the same syntax as [template literal strings in JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals), but is used in type positions.
Expand Down Expand Up @@ -299,7 +299,7 @@ declare function customThen<T, U>(
): Promise<Awaited<U>>;
```

Keep in mind that while these recursive types are powerful, but they should be used responsibly and sparingly.
Keep in mind that while these recursive types are powerful, they should be used responsibly and sparingly.

First off, these types can do a lot of work which means that they can increase type-checking time.
Trying to model numbers in the Collatz conjecture or Fibonacci sequence might be fun, but don't ship that in `.d.ts` files on npm.
Expand Down Expand Up @@ -583,7 +583,7 @@ TypeScript 4.1 ships with a quick fix to help fix this break.
In JavaScript, object spreads (like `{ ...foo }`) don't operate over falsy values.
So in code like `{ ...foo }`, `foo` will be skipped over if it's `null` or `undefined`.

Many users take advantage of this to spread in properties "conditionally".
Many users take advantage of this to spread properties "conditionally".
eugeneilyin marked this conversation as resolved.
Show resolved Hide resolved

```ts
interface Person {
Expand Down
Loading