From 2e045fbad6e65bd9f606d5d73bc52125fa0c2ca7 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 8 Apr 2020 14:14:58 -0700 Subject: [PATCH] Updated API Breaking Changes (markdown) --- API-Breaking-Changes.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/API-Breaking-Changes.md b/API-Breaking-Changes.md index 2032992..3f11dd5 100644 --- a/API-Breaking-Changes.md +++ b/API-Breaking-Changes.md @@ -4,7 +4,15 @@ # TypeScript 3.7 -- the typeArguments property from the TypeReference interface and provides a getTypeArguments method on the TypeChecker interface to be used instead. This change is necessary because resolution of type arguments in type references is now deferred due to the ability to create [recursive type references](https://github.com/microsoft/TypeScript/pull/33050). +- the `typeArguments` property has been removed from the `TypeReference` interface, and the `getTypeArguments` method on `TypeChecker` instances should be used instead. This change was necessary to defer resolution of type arguments in order to support [recursive type references](https://github.com/microsoft/TypeScript/pull/33050). + + As a workaround, you can define a helper function to support multiple versions of TypeScript. + + ```ts + function getTypeArguments(checker: ts.TypeChecker, typeRef: ts.TypeReference) { + return checker.getTypeArguments?.(typeRef) ?? typeRef.typeArguments; + } + ``` # TypeScript 3.1