Skip to content

Commit 947d4f7

Browse files
2 parents 8a33926 + 8be215e commit 947d4f7

File tree

4 files changed

+230
-5
lines changed

4 files changed

+230
-5
lines changed

API-Breaking-Changes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ See https://github.com/Microsoft/TypeScript/pull/15594 for more details.
3939

4040
# TypeScript 1.9
4141

42-
- [`LanguageService.getSourceFile` is removed](https://github.com/Microsoft/TypeScript/pull/7584); `LanguageService.getProgram().getSourceFile` should be used instead.
42+
- [`LanguageService.getSourceFile` has been removed](https://github.com/Microsoft/TypeScript/pull/7584); `LanguageService.getProgram().getSourceFile` should be used instead.
4343

4444
# TypeScript 1.7
4545

Breaking-Changes.md

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,230 @@ These changes list where implementation differs between versions as the spec and
22

33
> For breaking changes to the compiler/services API, please check the [[API Breaking Changes]] page.
44
5+
# TypeScript 3.1
6+
7+
## Some vendor-specific types are removed from `lib.d.ts`
8+
9+
TypeScript's built-in `.d.ts` library (`lib.d.ts` and family) is now partially generated from Web IDL files from the DOM specification. As a result some vendor-specific types have been removed.
10+
11+
<details><summary>Click here to the full list of removed types:</summary><p>
12+
13+
* `CanvasRenderingContext2D.mozImageSmoothingEnabled`
14+
* `CanvasRenderingContext2D.msFillRule`
15+
* `CanvasRenderingContext2D.oImageSmoothingEnabled`
16+
* `CanvasRenderingContext2D.webkitImageSmoothingEnabled`
17+
* `Document.caretRangeFromPoint`
18+
* `Document.createExpression`
19+
* `Document.createNSResolver`
20+
* `Document.execCommandShowHelp`
21+
* `Document.exitFullscreen`
22+
* `Document.exitPointerLock`
23+
* `Document.focus`
24+
* `Document.fullscreenElement`
25+
* `Document.fullscreenEnabled`
26+
* `Document.getSelection`
27+
* `Document.msCapsLockWarningOff`
28+
* `Document.msCSSOMElementFloatMetrics`
29+
* `Document.msElementsFromRect`
30+
* `Document.msElementsFromPoint`
31+
* `Document.onvisibilitychange`
32+
* `Document.onwebkitfullscreenchange`
33+
* `Document.onwebkitfullscreenerror`
34+
* `Document.pointerLockElement`
35+
* `Document.queryCommandIndeterm`
36+
* `Document.URLUnencoded`
37+
* `Document.webkitCurrentFullScreenElement`
38+
* `Document.webkitFullscreenElement`
39+
* `Document.webkitFullscreenEnabled`
40+
* `Document.webkitIsFullScreen`
41+
* `Document.xmlEncoding`
42+
* `Document.xmlStandalone`
43+
* `Document.xmlVersion`
44+
* `DocumentType.entities`
45+
* `DocumentType.internalSubset`
46+
* `DocumentType.notations`
47+
* `DOML2DeprecatedSizeProperty`
48+
* `Element.msContentZoomFactor`
49+
* `Element.msGetUntransformedBounds`
50+
* `Element.msMatchesSelector`
51+
* `Element.msRegionOverflow`
52+
* `Element.msReleasePointerCapture`
53+
* `Element.msSetPointerCapture`
54+
* `Element.msZoomTo`
55+
* `Element.onwebkitfullscreenchange`
56+
* `Element.onwebkitfullscreenerror`
57+
* `Element.webkitRequestFullScreen`
58+
* `Element.webkitRequestFullscreen`
59+
* `ElementCSSInlineStyle`
60+
* `ExtendableEventInit`
61+
* `ExtendableMessageEventInit`
62+
* `FetchEventInit`
63+
* `GenerateAssertionCallback`
64+
* `HTMLAnchorElement.Methods`
65+
* `HTMLAnchorElement.mimeType`
66+
* `HTMLAnchorElement.nameProp`
67+
* `HTMLAnchorElement.protocolLong`
68+
* `HTMLAnchorElement.urn`
69+
* `HTMLAreasCollection`
70+
* `HTMLHeadElement.profile`
71+
* `HTMLImageElement.msGetAsCastingSource`
72+
* `HTMLImageElement.msGetAsCastingSource`
73+
* `HTMLImageElement.msKeySystem`
74+
* `HTMLImageElement.msPlayToDisabled`
75+
* `HTMLImageElement.msPlayToDisabled`
76+
* `HTMLImageElement.msPlayToPreferredSourceUri`
77+
* `HTMLImageElement.msPlayToPreferredSourceUri`
78+
* `HTMLImageElement.msPlayToPrimary`
79+
* `HTMLImageElement.msPlayToPrimary`
80+
* `HTMLImageElement.msPlayToSource`
81+
* `HTMLImageElement.msPlayToSource`
82+
* `HTMLImageElement.x`
83+
* `HTMLImageElement.y`
84+
* `HTMLInputElement.webkitdirectory`
85+
* `HTMLLinkElement.import`
86+
* `HTMLMetaElement.charset`
87+
* `HTMLMetaElement.url`
88+
* `HTMLSourceElement.msKeySystem`
89+
* `HTMLStyleElement.disabled`
90+
* `HTMLSummaryElement`
91+
* `MediaQueryListListener`
92+
* `MSAccountInfo`
93+
* `MSAudioLocalClientEvent`
94+
* `MSAudioLocalClientEvent`
95+
* `MSAudioRecvPayload`
96+
* `MSAudioRecvSignal`
97+
* `MSAudioSendPayload`
98+
* `MSAudioSendSignal`
99+
* `MSConnectivity`
100+
* `MSCredentialFilter`
101+
* `MSCredentialParameters`
102+
* `MSCredentials`
103+
* `MSCredentialSpec`
104+
* `MSDCCEvent`
105+
* `MSDCCEventInit`
106+
* `MSDelay`
107+
* `MSDescription`
108+
* `MSDSHEvent`
109+
* `MSDSHEventInit`
110+
* `MSFIDOCredentialParameters`
111+
* `MSIceAddrType`
112+
* `MSIceType`
113+
* `MSIceWarningFlags`
114+
* `MSInboundPayload`
115+
* `MSIPAddressInfo`
116+
* `MSJitter`
117+
* `MSLocalClientEvent`
118+
* `MSLocalClientEventBase`
119+
* `MSNetwork`
120+
* `MSNetworkConnectivityInfo`
121+
* `MSNetworkInterfaceType`
122+
* `MSOutboundNetwork`
123+
* `MSOutboundPayload`
124+
* `MSPacketLoss`
125+
* `MSPayloadBase`
126+
* `MSPortRange`
127+
* `MSRelayAddress`
128+
* `MSSignatureParameters`
129+
* `MSStatsType`
130+
* `MSStreamReader`
131+
* `MSTransportDiagnosticsStats`
132+
* `MSUtilization`
133+
* `MSVideoPayload`
134+
* `MSVideoRecvPayload`
135+
* `MSVideoResolutionDistribution`
136+
* `MSVideoSendPayload`
137+
* `NotificationEventInit`
138+
* `PushEventInit`
139+
* `PushSubscriptionChangeInit`
140+
* `RTCIdentityAssertionResult`
141+
* `RTCIdentityProvider`
142+
* `RTCIdentityProviderDetails`
143+
* `RTCIdentityValidationResult`
144+
* `Screen.deviceXDPI`
145+
* `Screen.logicalXDPI`
146+
* `SVGElement.xmlbase`
147+
* `SVGGraphicsElement.farthestViewportElement`
148+
* `SVGGraphicsElement.getTransformToElement`
149+
* `SVGGraphicsElement.nearestViewportElement`
150+
* `SVGStylable`
151+
* `SVGTests.hasExtension`
152+
* `SVGTests.requiredFeatures`
153+
* `SyncEventInit`
154+
* `ValidateAssertionCallback`
155+
* `WebKitDirectoryEntry`
156+
* `WebKitDirectoryReader`
157+
* `WebKitEntriesCallback`
158+
* `WebKitEntry`
159+
* `WebKitErrorCallback`
160+
* `WebKitFileCallback`
161+
* `WebKitFileEntry`
162+
* `WebKitFileSystem`
163+
* `Window.clearImmediate`
164+
* `Window.msSetImmediate`
165+
* `Window.setImmediate`
166+
</p></details>
167+
168+
### Recommendations:
169+
170+
If your run-time guaranteed to have some of these names available at run-time (e.g. IE-only app) add the declarations locally in your project, e.g.:
171+
172+
To Add `Element.msMatchesSelector` back, add the flowing to a local `dom.ie.d.ts`
173+
174+
```ts
175+
interface Element {
176+
msMatchesSelector(selectors: string): boolean;
177+
}
178+
```
179+
180+
Similarly, to add `clearImmediate` and `setImmediate`, you can add a declaration for `Window` in your local `dom.ie.d.ts`:
181+
182+
```ts
183+
interface Window {
184+
clearImmediate(handle: number): void;
185+
setImmediate(handler: (...args: any[]) => void): number;
186+
setImmediate(handler: any, ...args: any[]): number;
187+
}
188+
```
189+
190+
## Narrowing functions now intersects `{}`, `Object`, and unconstrained generic type parameters.
191+
192+
The following code will now complain about `x` no longer being callable:
193+
194+
```ts
195+
function foo<T>(x: T | (() => string)) {
196+
if (typeof x === "function") {
197+
x();
198+
// ~~~
199+
// Cannot invoke an expression whose type lacks a call signature. Type '(() => string) | (T & Function)' has no compatible call signatures.
200+
}
201+
}
202+
```
203+
204+
This is because, unlike previously where `T` would be narrowed away, it is now *expanded* into `T & Function`. However, because this type has no call signatures declared, the type system won't find any common call signature between `T & Function` and `() => string`.
205+
206+
Instead, consider using a more specific type than `{}` or `Object`, and consider adding additional constraints to what you expect `T` might be.
207+
5208
# TypeScript 3.0
6209

7210
## The `unknown` keyword is reserved
8211

9212
`unknown` is now a reserved type name, as it is now a built-in type. Depending on your intended use of `unknown`, you may want to remove the declaration entirely (favoring the newly introduced `unknown` type), or rename it to something else.
10213

214+
## Intersecting with `null`/`undefined` reduces to `null`/`undefined` outside of `strictNullChecks`
215+
216+
In the following example, `A` has the type `null` and `B` has the type `undefined` when `strictNullChecks` is turned off:
217+
218+
```ts
219+
type A = { a: number } & null; // null
220+
type B = { a: number } & undefined; // undefined
221+
```
222+
223+
This is because TypeScript 3.0 is better at reducing subtypes and supertypes in intersection and union types respectively; however, because `null` and `undefined` are both considered subtypes of every other type when `strictNullChecks` is off, an intersection with some object type and either will always reduce to `null` or `undefined`.
224+
225+
### Recommendation
226+
227+
If you were relying on `null` and `undefined` to be ["identity" elements](https://en.wikipedia.org/wiki/Identity_element) under intersections, you should look for a way to use `unknown` instead of `null` or `undefined` wherever they appeared
228+
11229
# TypeScript 2.9
12230

13231
## `keyof` now includes `string`, `number` and `symbol` keys

Debugging-Language-Service-in-VS-Code.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ From here, there are different steps for debugging the client- and server-side,
4242
$env:TSS_DEBUG = 5859
4343
```
4444

45-
* Manually edit `extensions/typescript/src/typescriptServiceClient.ts` in your development-side VS Code, setting the port to an open one.
45+
* Alternatively, manually edit `extensions/typescript/src/typescriptServiceClient.ts` in your development-side VS Code, setting the port to an open one.
4646

4747
2. Update `launch.json` with an option to attach to the node instance, with sourcemaps from your `built/local` folder.
4848

Roadmap.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,21 @@
1111
* [Investigate error messages in haiku or iambic pentameter](https://twitter.com/kitsonk/status/973651805950242816)
1212
* Decorators for function expressions/arrow functions
1313

14-
# 3.1 (August 2018)
15-
14+
# 3.2 (November 2018)
1615

1716
* [ ] [Support for `BigInt`](https://github.com/Microsoft/TypeScript/issues/15096)
18-
* [ ] [Named type arguments & partial type argument inference](https://github.com/Microsoft/TypeScript/pull/23696)
17+
* [ ] [Partial type argument inference](https://github.com/Microsoft/TypeScript/pull/26349)
1918
* [ ] Refactorings to...
2019
* [ ] [Rename files from import/export paths](https://github.com/Microsoft/TypeScript/issues/24501)
2120

21+
# 3.1 (September 2018)
22+
23+
* [X] [Mapped tuple types](https://github.com/Microsoft/TypeScript/issues/25947)
24+
* [X] [Property assignments on function declarations](https://github.com/Microsoft/TypeScript/pull/26368)
25+
* [X] [`typesVersions` redirects](https://github.com/Microsoft/TypeScript/issues/22605)
26+
* [X] [Error UX improvements](https://github.com/Microsoft/TypeScript/issues/26077)
27+
* [X] [Refactor from `Promise#then`/`catch` to `async`/`await`](https://github.com/Microsoft/TypeScript/pull/26373)
28+
2229
# 3.0 (July 2018)
2330

2431
* [X] [Support for project references/composite projects](https://github.com/Microsoft/TypeScript/issues/3469#issuecomment-400439520)

0 commit comments

Comments
 (0)