| [9af201e] | 1 | # 3.21.0
|
|---|
| 2 |
|
|---|
| 3 | **Features:**
|
|---|
| 4 |
|
|---|
| 5 | * added `getWellKnownSymbolPropertyOfType` to reliably get symbol named properties due to changes in typescript@4.3
|
|---|
| 6 | * `getPropertyNameOfWellKnownSymbol` is now deprecated
|
|---|
| 7 |
|
|---|
| 8 | # 3.20.0
|
|---|
| 9 |
|
|---|
| 10 | **Features:**
|
|---|
| 11 |
|
|---|
| 12 | * `findImports` and `findImportLikeNodes` take an additional parameter `ignoreFileName`. The default value for this paramter is `true` to remain backwards compatible. When set to `false`, it matches the behavior of TypeScript, i.e. only looks for `require` in JavaScript files.
|
|---|
| 13 |
|
|---|
| 14 | **Bugfixes:**
|
|---|
| 15 |
|
|---|
| 16 | * `getJsDoc` for `EndOfFileToken` now returns `JSDoc` comments whose contents are usable with the type checker
|
|---|
| 17 |
|
|---|
| 18 | # 3.19.1
|
|---|
| 19 |
|
|---|
| 20 | **Bugfixes:**
|
|---|
| 21 |
|
|---|
| 22 | * `getSymbolOfClassLikeDeclaration` no longer crashes on anonymous mixin classes
|
|---|
| 23 |
|
|---|
| 24 | # 3.19.0
|
|---|
| 25 |
|
|---|
| 26 | **Features:**
|
|---|
| 27 |
|
|---|
| 28 | * `getSymbolOfClassLikeDeclaration` to retrieve the symbol of class declarations and expressions regardless whether they have a name or not
|
|---|
| 29 | * `getBaseOfClassLikeDeclaration` to conventiently get the expression after `extends`
|
|---|
| 30 | * `getBaseClassMemberOfClassElement` to look up the declaration of a class member in the base class
|
|---|
| 31 |
|
|---|
| 32 | **Bugfixes:**
|
|---|
| 33 |
|
|---|
| 34 | * `getConstructorTypeOfClassLikeDeclaration` now really returns the constructor type (the static side of the class), previously it returned the instance type
|
|---|
| 35 | * `hasExhaustiveCaseClauses` allows additional case clauses with `null`, `undefined` and `never`
|
|---|
| 36 |
|
|---|
| 37 | # 3.18.0
|
|---|
| 38 |
|
|---|
| 39 | **Features:**
|
|---|
| 40 |
|
|---|
| 41 | * Source maps for easier debugging
|
|---|
| 42 | * JSDoc is preserved in declaration files
|
|---|
| 43 | * Comments are presered in transpiled code
|
|---|
| 44 | * Everything you need to handle the control flow changes of TypeScript@3.7
|
|---|
| 45 | * `callExpressionAffectsControlFlow` to determine whether a CallExpression affects control flow by returning `never` or `asserts`
|
|---|
| 46 | * `hasExhaustiveCaseClauses` to determine whether a SwitchStatement's CaseClauses handle every possible value
|
|---|
| 47 | * `endsControlFlow` and `getControlFlowEnd` take an optional `checker` parameter to recognize exhaustive SwitchStatements and control flow effects of CallExpressions
|
|---|
| 48 | * `formatPseudoBigInt` converts TypeScript's representation of a BigInt to its literal representation as you would write it in your source code
|
|---|
| 49 | * `getAstNodeAtPosition` similar to `getTokenAtPosition`, but only operates on AST Nodes
|
|---|
| 50 | * `removeOptionalChainingUndefinedMarkerType` and `isOptionalChainingUndefinedMarkerType` to handle types originating in an optional chain
|
|---|
| 51 | * `findImports` and `findImportLikeNodes`: prepare for import assertions
|
|---|
| 52 | * `getTsCheckDirective` as new name for `getCheckJsDirective`
|
|---|
| 53 | * `getCheckJsDirective` is now deprecated
|
|---|
| 54 |
|
|---|
| 55 | **Bugfixes:**
|
|---|
| 56 |
|
|---|
| 57 | * `getUsageDomain`: handles NamespaceExport and NamedTupleMember
|
|---|
| 58 | * `getPropertyName`: handles parentheses and negative numeric literals, excludes RegExp literals and private identifiers
|
|---|
| 59 | * `getSingleLateBoundPropertyNameOfPropertyName` and `getLateBoundPropertyNamesOfPropertyName`: handles private identifiers
|
|---|
| 60 | * `hasAccessModifier`: handles JSDoc access modifier
|
|---|
| 61 | * `hasSideEffects`: correctly determines side effects of (static) property initializers
|
|---|
| 62 | * `isExpressionValueUsed`: handle nullish coalescing and conditional assignment operators
|
|---|
| 63 | * `canHaveJsDoc`: aligned with upstream changes in TypeScript
|
|---|
| 64 | * `isCompilerOptionEnabled`:
|
|---|
| 65 | * `noUncheckedIndexedAccess` requires `strictNullChecks`
|
|---|
| 66 | * `checkJs` implies `allowJs`
|
|---|
| 67 | * `emitDeclarationOnly` requires `declaration`
|
|---|
| 68 | * `isInConstContext`: handle template string interpolations
|
|---|
| 69 | * excluded unnecessary files from npm package
|
|---|
| 70 |
|
|---|
| 71 | # 3.17.1
|
|---|
| 72 |
|
|---|
| 73 | **Bugfixes:**
|
|---|
| 74 |
|
|---|
| 75 | * `isValidJsxIdentifier`, `isValidPropertyAccess`, `isValidPropertyName`: fix unicode character width handling
|
|---|
| 76 |
|
|---|
| 77 | # 3.17.0
|
|---|
| 78 |
|
|---|
| 79 | **Features:**
|
|---|
| 80 |
|
|---|
| 81 | * `isValidJsxIdentifier` added an optional parameter to specify the target ECMAScript version
|
|---|
| 82 |
|
|---|
| 83 | **Bugfixes:**
|
|---|
| 84 |
|
|---|
| 85 | * `isValidJsxIdentifier` now handles astral plane characters
|
|---|
| 86 |
|
|---|
| 87 | # 3.16.0
|
|---|
| 88 |
|
|---|
| 89 | **Features:**
|
|---|
| 90 |
|
|---|
| 91 | * added `getIteratorYieldResultFromIteratorResult` to extract the `yield`ed type from `IteratorResult<TYield, TReturn, TNext>`
|
|---|
| 92 |
|
|---|
| 93 | # 3.15.0
|
|---|
| 94 |
|
|---|
| 95 | **Features:**
|
|---|
| 96 |
|
|---|
| 97 | * `isValidIdentifier`, `isValidPropertyName`, `isValidPropertyAccess`, `isValidNumericLiteral` added an optional parameter to specify the target ECMAScript version
|
|---|
| 98 |
|
|---|
| 99 | **Bugfixes:**
|
|---|
| 100 |
|
|---|
| 101 | * `isValidPropertyName`, `isValidPropertyAccess` now handle astral plane characters
|
|---|
| 102 |
|
|---|
| 103 | # 3.14.1
|
|---|
| 104 |
|
|---|
| 105 | **Bugfixes:**
|
|---|
| 106 |
|
|---|
| 107 | * `findImports`: fixed crash on nested namespaces
|
|---|
| 108 |
|
|---|
| 109 | # 3.14.0
|
|---|
| 110 |
|
|---|
| 111 | **Features:**
|
|---|
| 112 |
|
|---|
| 113 | * added `getInstanceTypeOfClassLikeDeclaration` and `getConstructorTypeOfClassLikeDeclaration`
|
|---|
| 114 | * added `AccessKind.Delete` to `getAccessKind`: `getAccessKind(node) & AccessKind.Modification` can now be used to restore the old behavior of `isReassignmentTarget(node)`
|
|---|
| 115 |
|
|---|
| 116 | # 3.13.0
|
|---|
| 117 |
|
|---|
| 118 | **Features:**
|
|---|
| 119 |
|
|---|
| 120 | * `getAccessKind` determines whether an expression is read from, written to or both
|
|---|
| 121 | * optimized `getPropertyOfType` for unambiguous property names to partially work around https://github.com/microsoft/TypeScript/issues/31565
|
|---|
| 122 |
|
|---|
| 123 | **Bugfixes:**
|
|---|
| 124 |
|
|---|
| 125 | * `isReassignmentTarget` no longer returns `true` for `DeleteExpression` as it doesn't **assign** a value to the operand
|
|---|
| 126 |
|
|---|
| 127 | # 3.12.0
|
|---|
| 128 |
|
|---|
| 129 | **Features:**
|
|---|
| 130 |
|
|---|
| 131 | * `getLateBoundPropertyNamesOfPropertyName` returns all statically analyzable names of a property, method, ...
|
|---|
| 132 | * `getSingleLateBoundPropertyNameOfPropertyName` returns the literal name of a property, method, ... if statically analyzable
|
|---|
| 133 |
|
|---|
| 134 | **Bugfixes:**
|
|---|
| 135 |
|
|---|
| 136 | * fixed circular import
|
|---|
| 137 |
|
|---|
| 138 | # 3.11.0
|
|---|
| 139 |
|
|---|
| 140 | **Features:**
|
|---|
| 141 |
|
|---|
| 142 | * typeguards: `isNumericOrStringLikeLiteral`, `isTupleTypeReference`
|
|---|
| 143 | * `intersectionTypeParts` as counterpart to `unionTypeParts`
|
|---|
| 144 | * `someTypePart` to execute a callback for each union or intersection constituent until the callback returns true
|
|---|
| 145 | * `getPropertyOfType` looks up a property by its escaped name
|
|---|
| 146 | * `isPropertyReadonlyInType` determines whether a property in a given type cannot be written to
|
|---|
| 147 | * `symbolHasReadonlyDeclaration` determines if a Symbol has any readonly or constant declaration
|
|---|
| 148 | * `isNumericPropertyName` determines whether a property name would match an index signature
|
|---|
| 149 | * `isBindableObjectDefinePropertyCall` returns true for statically analyzable forms of `Object.defineProperty(o, 'p', {value, writable})`
|
|---|
| 150 | * `isReadonlyAssignmentDeclaration` determines whether an `Object.defineProperty` call is known to result in a readonly property
|
|---|
| 151 | * `getLateBoundPropertyNames` returns all known property names of an expression
|
|---|
| 152 | * `getPropertyNameFromType` extracts the property name of literal types
|
|---|
| 153 | * `isWellKnownSymbolLiterally` to recognize expressions in the form of `Symbol.<name>`
|
|---|
| 154 | * `getPropertyNameOfWellKnownSymbol` returns the escaped name for a well known symbol literal
|
|---|
| 155 | * `unwrapParentheses` returns the first child expression that is not a `ParenthesizedExpression`
|
|---|
| 156 |
|
|---|
| 157 | # 3.10.0
|
|---|
| 158 |
|
|---|
| 159 | **Features:**
|
|---|
| 160 |
|
|---|
| 161 | * `isCompilerOptionEnabled`: `incremental` is implicitly enabled by `composite`
|
|---|
| 162 |
|
|---|
| 163 | **Bugfixes:**
|
|---|
| 164 |
|
|---|
| 165 | * `collectVariableUsage`/`getUsageDomain`: no longer treat `as const` as type usage
|
|---|
| 166 |
|
|---|
| 167 | # 3.9.1
|
|---|
| 168 |
|
|---|
| 169 | **Bugfixes:**
|
|---|
| 170 |
|
|---|
| 171 | * reverted invalid deprecation of `canHaveJsdoc`
|
|---|
| 172 | * fixed condition in `parseJsdocOfNode`
|
|---|
| 173 |
|
|---|
| 174 | # 3.9.0
|
|---|
| 175 |
|
|---|
| 176 | **Features:**
|
|---|
| 177 |
|
|---|
| 178 | * added typeguards: `isNullLiteral` and `isBooleanLiteral`
|
|---|
| 179 |
|
|---|
| 180 | # 3.8.0
|
|---|
| 181 |
|
|---|
| 182 | **Features:**
|
|---|
| 183 |
|
|---|
| 184 | * exposes typeguards for typescript@3.2 by default
|
|---|
| 185 | * added utilities: `isConstAssertion` and `isInConstContext`
|
|---|
| 186 |
|
|---|
| 187 | # 3.7.0
|
|---|
| 188 |
|
|---|
| 189 | **Features:**
|
|---|
| 190 |
|
|---|
| 191 | * added `isBlockScopedDeclarationStatement`
|
|---|
| 192 | * added `isInSingleStatementContext`
|
|---|
| 193 |
|
|---|
| 194 | # 3.6.0
|
|---|
| 195 |
|
|---|
| 196 | **Features:**
|
|---|
| 197 |
|
|---|
| 198 | * added `getCheckJsDirective` utility to parse `// @ts-check` and `// @ts-nocheck` pragmas
|
|---|
| 199 |
|
|---|
| 200 | # 3.5.2
|
|---|
| 201 |
|
|---|
| 202 | **Bugfixes:**
|
|---|
| 203 |
|
|---|
| 204 | * Published declaration files no longer contain `const enum`. They are now declared as regular enums instead.
|
|---|
| 205 |
|
|---|
| 206 | # 3.5.1
|
|---|
| 207 |
|
|---|
| 208 | **Bugfixes:**
|
|---|
| 209 |
|
|---|
| 210 | * `isThenableType` allows `Node` instead of `Expression` as parameter
|
|---|
| 211 | * `isBlockScopeBoundary` and `isScopeBoundary` consider `WithStatement` as scope boundary
|
|---|
| 212 |
|
|---|
| 213 | # 3.5.0
|
|---|
| 214 |
|
|---|
| 215 | **Features:**
|
|---|
| 216 |
|
|---|
| 217 | * correctly handle BigInt literals
|
|---|
| 218 | * added typeguard `isBigIntLiteral`
|
|---|
| 219 | * `isLiteralType` recognises BigInt
|
|---|
| 220 | * `getPropertyName` adds special handling for BigInt
|
|---|
| 221 |
|
|---|
| 222 | # 3.4.0
|
|---|
| 223 |
|
|---|
| 224 | **Features:**
|
|---|
| 225 |
|
|---|
| 226 | * added utility `commentText` to get the actual text content of a comment excluding the characters needed to start and end the comment
|
|---|
| 227 |
|
|---|
| 228 | # 3.3.1
|
|---|
| 229 |
|
|---|
| 230 | **Bugfixes:**
|
|---|
| 231 |
|
|---|
| 232 | * `findImports`: fixed handling of ImportEqualsDeclaration
|
|---|
| 233 |
|
|---|
| 234 | # 3.3.0
|
|---|
| 235 |
|
|---|
| 236 | **Features:**
|
|---|
| 237 |
|
|---|
| 238 | * `isCompilerOptionEnabled`: recognizes `strictBindCallApply`
|
|---|
| 239 | * `getTokenAtPosition`: optionally includes JSDoc during lookup
|
|---|
| 240 |
|
|---|
| 241 | **Bugfixes:**
|
|---|
| 242 |
|
|---|
| 243 | * `isCompilerOptionEnabled`: correctly implements logic for `allowSyntheticDefaultImports`
|
|---|
| 244 | * `findImportLikeNodes`: correctly finds imports in namespaces
|
|---|
| 245 | * `findImportLikeNodes` / `findImports`: finds import types in JSDoc of JS files
|
|---|
| 246 |
|
|---|
| 247 | # 3.2.0
|
|---|
| 248 |
|
|---|
| 249 | **Features:**
|
|---|
| 250 |
|
|---|
| 251 | * added utility `findImportLikeNodes` that works similar to `findImports` but returns the import statement or expression instead of the module specifier and doesn't filter non-string module specifiers
|
|---|
| 252 |
|
|---|
| 253 | # 3.1.0
|
|---|
| 254 |
|
|---|
| 255 | **Features:**
|
|---|
| 256 |
|
|---|
| 257 | * added utilities: `isKeywordKind` and `isValidJsxIdentifier`
|
|---|
| 258 | * exposes typeguards for typescript@3.0 by default
|
|---|
| 259 |
|
|---|
| 260 | # 3.0.0
|
|---|
| 261 |
|
|---|
| 262 | :warning: **Breaking Changes:**
|
|---|
| 263 |
|
|---|
| 264 | * Dropped support for `typescript@<2.8.0`
|
|---|
| 265 | * Dropped support for Node.js 4
|
|---|
| 266 | * Removed deprecated APIs:
|
|---|
| 267 | * `getIdentifierText`, `isJsxFramgment`, `ImportOptions`
|
|---|
| 268 | * deprected overloads of `isModifierFlagSet`, `findImports` and `getControlFlowEnd`
|
|---|
| 269 | * control flow related symbols can no longer be imported from `'tsutils/util/util'`, import directly from `'tsutils/util/control-flow'` or `'tsutils/util'`
|
|---|
| 270 | * `isFunctionScopeBoundary` and `isBlockScopeBoundary` now return a enum member of `ScopeBoundary` instead of a boolean
|
|---|
| 271 | * `isFunctionScopeBoundary` no longer returns a truthy value for `InterfaceDeclaration`, `TypeAliasDeclaration`
|
|---|
| 272 |
|
|---|
| 273 | **Features:**
|
|---|
| 274 |
|
|---|
| 275 | * added utility `isTypeScopeBoundary` returning `ScopeBoundary.Type` or `ScopeBoundary.ConditionalType`
|
|---|
| 276 | * added enum `ScopeBoundarySelector` whose members can be used to determine if a declaration belongs to a given `ScopeBoundary` by using bitwise AND
|
|---|
| 277 |
|
|---|
| 278 | **Bugfixes:**
|
|---|
| 279 |
|
|---|
| 280 | * `collectVariableUsage` now correctly handles `infer T` nested inside function signatures or mapped types
|
|---|
| 281 | * `isCompilerOptionEnabled` correctly handles `skipDefaultLibCHeck` and `suppressImplicitAnyIndexErrors`
|
|---|
| 282 |
|
|---|
| 283 | # 2.29.0
|
|---|
| 284 |
|
|---|
| 285 | **Features:**
|
|---|
| 286 |
|
|---|
| 287 | * added utility `isCompilerOptionEnabled`
|
|---|
| 288 |
|
|---|
| 289 | # 2.28.0
|
|---|
| 290 |
|
|---|
| 291 | Typeguards are now split into multiple submodules for each version of TypeScript (starting with 2.8.0).
|
|---|
| 292 | That means you can now import directly from `"tsutils/typeguard/2.8"` to get compatible declaraton files for TypeScript@2.8.
|
|---|
| 293 | For more information please read the relevant section in [README.md](README.md).
|
|---|
| 294 |
|
|---|
| 295 | **Features:**
|
|---|
| 296 |
|
|---|
| 297 | * added typeguards: `isTupleType`, `isOptionalTypeNode`, `isRestTypeNode`, `isSyntheticExpression` (currently available from `"tsutils/typeguard/3.0"`)
|
|---|
| 298 | * added utility `isStrictCompilerOptionEnabled`
|
|---|
| 299 |
|
|---|
| 300 | # 2.27.2
|
|---|
| 301 |
|
|---|
| 302 | Avoid crash caused by removed function in `typescript@3.0.0`.
|
|---|
| 303 |
|
|---|
| 304 | # 2.27.1
|
|---|
| 305 |
|
|---|
| 306 | Added support for TypeScript@3.0.0 nightly builds.
|
|---|
| 307 |
|
|---|
| 308 | # 2.27.0
|
|---|
| 309 |
|
|---|
| 310 | **Features:**
|
|---|
| 311 |
|
|---|
| 312 | * added `getIIFE` utility
|
|---|
| 313 |
|
|---|
| 314 | # 2.26.2
|
|---|
| 315 |
|
|---|
| 316 | **Bugfixes:**
|
|---|
| 317 |
|
|---|
| 318 | * `forEachComment` and `forEachTokenWithTrivia` no longer duplicate comments around missing nodes
|
|---|
| 319 |
|
|---|
| 320 | # 2.26.1
|
|---|
| 321 |
|
|---|
| 322 | **Bugfixes:**
|
|---|
| 323 |
|
|---|
| 324 | * fixed crash in `hasSideEffects` with tagged template literal without substitution: ``tag`template` ``
|
|---|
| 325 |
|
|---|
| 326 | # 2.26.0
|
|---|
| 327 |
|
|---|
| 328 | **Features:**
|
|---|
| 329 |
|
|---|
| 330 | * added typeguard `isLiteralTypeNode`
|
|---|
| 331 | * added support for type imports (`type T = import('foo')`) to `findImports` via `ImportKind.ImportType`
|
|---|
| 332 |
|
|---|
| 333 | # 2.25.1
|
|---|
| 334 |
|
|---|
| 335 | **Bugfixes:**
|
|---|
| 336 |
|
|---|
| 337 | * `collectVariableUsage`: fixed name lookup in function signatures to match runtime behavior. Note that this is not completely fixed in TypeScript, yet. See: [Microsoft/TypeScript#22825](https://github.com/Microsoft/TypeScript/issues/22825) and [Microsoft/TypeScript#22769](https://github.com/Microsoft/TypeScript/issues/22769)
|
|---|
| 338 |
|
|---|
| 339 | # 2.25.0
|
|---|
| 340 |
|
|---|
| 341 | **Features:**
|
|---|
| 342 |
|
|---|
| 343 | * added utilities: `isStatementInAmbientContext` and `isAmbientModuleBlock`
|
|---|
| 344 |
|
|---|
| 345 | # 2.24.0
|
|---|
| 346 |
|
|---|
| 347 | **Features:**
|
|---|
| 348 |
|
|---|
| 349 | * added typeguards for typescript@2.8: `isConditionalTypeNode`, `isInferTypeNode`, `isConditionalType`, `isInstantiableType`, `isSubstitutionType`
|
|---|
| 350 |
|
|---|
| 351 | # 2.23.0
|
|---|
| 352 |
|
|---|
| 353 | **Features:**
|
|---|
| 354 |
|
|---|
| 355 | * added typeguard `isForInOrOfStatement`
|
|---|
| 356 |
|
|---|
| 357 | **Bugfixes:**
|
|---|
| 358 |
|
|---|
| 359 | * correctly handle comments in generic JSX elements: `<MyComponent<string>/*comment*/></MyComponent>`
|
|---|
| 360 | * fixed a bug with false positive trailing comments at the end of JSX self closing element: `<div><br/>/*no comment*/</div>`
|
|---|
| 361 |
|
|---|
| 362 | # 2.22.2
|
|---|
| 363 |
|
|---|
| 364 | **Bugfixes:**
|
|---|
| 365 |
|
|---|
| 366 | * `collectVariableUsage`: handle ConditionalTypes and `infer T`, which will be introduced in TypeScript@2.8.0 and are already available in nightly builds
|
|---|
| 367 | * `isLiteralType` no longer returns true for `ts.TypeFlags.BooleanLiteral` as this is not a `ts.LiteralType`
|
|---|
| 368 |
|
|---|
| 369 | # 2.22.1
|
|---|
| 370 |
|
|---|
| 371 | **Bugfixes:**
|
|---|
| 372 |
|
|---|
| 373 | * `endsControlFlow`:
|
|---|
| 374 | * handle loops that might not even run a single iteration
|
|---|
| 375 | * handle constant boolean conditions in loops and if
|
|---|
| 376 |
|
|---|
| 377 | # 2.22.0
|
|---|
| 378 |
|
|---|
| 379 | **Features:**
|
|---|
| 380 |
|
|---|
| 381 | * added `isFalsyType` utility
|
|---|
| 382 |
|
|---|
| 383 | # 2.21.2
|
|---|
| 384 |
|
|---|
| 385 | **Bugfixes:**
|
|---|
| 386 |
|
|---|
| 387 | * fixed compile error with `typescript@2.8.0-dev`
|
|---|
| 388 |
|
|---|
| 389 | # 2.21.1
|
|---|
| 390 |
|
|---|
| 391 | **Bugfixes:**
|
|---|
| 392 |
|
|---|
| 393 | * `isReassignmentTarget`: handle type assertions and non-null assertion
|
|---|
| 394 |
|
|---|
| 395 | # 2.21.0
|
|---|
| 396 |
|
|---|
| 397 | **Bugfixes:**
|
|---|
| 398 |
|
|---|
| 399 | * `forEachDeclaredVariable` uses a more precise type for the callback parameter to make it useable again with typescript@2.7.1
|
|---|
| 400 |
|
|---|
| 401 | **Features:**
|
|---|
| 402 |
|
|---|
| 403 | * added `isUniqueESSymbolType` typeguard
|
|---|
| 404 |
|
|---|
| 405 | # 2.20.0
|
|---|
| 406 |
|
|---|
| 407 | **Features:**
|
|---|
| 408 |
|
|---|
| 409 | * added `isThenableType` utility
|
|---|
| 410 | * added `unionTypeParts` utility
|
|---|
| 411 |
|
|---|
| 412 | # 2.19.1
|
|---|
| 413 |
|
|---|
| 414 | **Bugfixes:**
|
|---|
| 415 |
|
|---|
| 416 | * `forEachComment`, `getCommentAtPosition` and `isPositionInComment`: skip shebang (`#! something`) to not miss following comments at the start of the file
|
|---|
| 417 |
|
|---|
| 418 | # 2.19.0
|
|---|
| 419 |
|
|---|
| 420 | **Features:**
|
|---|
| 421 |
|
|---|
| 422 | * added `WrappedAst` interface that models the type of a wrapped SourceFile more accurate
|
|---|
| 423 | * added `getWrappedNodeAtPosition` utiltiy that takes a `NodeWrap` and returns the most deeply nested NodeWrap that contains the given position
|
|---|
| 424 |
|
|---|
| 425 | # 2.18.0
|
|---|
| 426 |
|
|---|
| 427 | **Features:**
|
|---|
| 428 |
|
|---|
| 429 | * `getControlFlowEnd` accepts BlockLike as argument
|
|---|
| 430 |
|
|---|
| 431 | **Bugfixes:**
|
|---|
| 432 |
|
|---|
| 433 | * `getControlFlowEnd` and `endsControlFlow`: correctly handle nested LabeledStatements
|
|---|
| 434 | * `endsControlFlow` removed erroneous special case when an IterationStatement is passed as argument whose parent is a LabeledStatement.
|
|---|
| 435 | * if you want labels of an IterationStatement (or SwitchStatement) to be handled, you need to pass the LabeledStatement as argument.
|
|---|
| 436 | * :warning: this fix may change the returned value if you relied on the buggy behavior
|
|---|
| 437 |
|
|---|
| 438 | **Deprecations:**
|
|---|
| 439 |
|
|---|
| 440 | * deprecated overload of `getControlFlowEnd` that contains the `label` parameter. This parameter is no longer used and should no longer be passed to the function.
|
|---|
| 441 |
|
|---|
| 442 | # 2.17.1
|
|---|
| 443 |
|
|---|
| 444 | **Bugfixes:**
|
|---|
| 445 |
|
|---|
| 446 | * `getControlFlowEnd` and `endsControlFlow` (#22)
|
|---|
| 447 | * ThrowStatements inside `try` are filtered out if there is a `catch` clause
|
|---|
| 448 | * TryStatements with `catch` only end control flow if `try` AND `catch` definitely end control flow
|
|---|
| 449 |
|
|---|
| 450 | # 2.17.0
|
|---|
| 451 |
|
|---|
| 452 | **Features:**
|
|---|
| 453 |
|
|---|
| 454 | * added `kind` property to `NodeWrap`
|
|---|
| 455 | * added `getControlFlowEnd` to public API
|
|---|
| 456 |
|
|---|
| 457 | # 2.16.0
|
|---|
| 458 |
|
|---|
| 459 | **Features:**
|
|---|
| 460 |
|
|---|
| 461 | * added `isDecorator` and `isCallLikeExpression` typeguards
|
|---|
| 462 |
|
|---|
| 463 | # 2.15.0
|
|---|
| 464 |
|
|---|
| 465 | **Features:**
|
|---|
| 466 |
|
|---|
| 467 | * added `convertAst` utility to produce a flattened and wrapped version of the AST
|
|---|
| 468 |
|
|---|
| 469 | # 2.14.0
|
|---|
| 470 |
|
|---|
| 471 | **Features:**
|
|---|
| 472 |
|
|---|
| 473 | * added `isDeleteExpression`
|
|---|
| 474 | * added `getLineBreakStyle`
|
|---|
| 475 |
|
|---|
| 476 | # 2.13.1
|
|---|
| 477 |
|
|---|
| 478 | **Bugfixes:**
|
|---|
| 479 |
|
|---|
| 480 | * fixed name of `isJsxFragment`
|
|---|
| 481 |
|
|---|
| 482 | # 2.13.0
|
|---|
| 483 |
|
|---|
| 484 | **Features:**
|
|---|
| 485 |
|
|---|
| 486 | * added support for `JsxFragment` introduced in typescript@2.6.2
|
|---|
| 487 | * added corresponding typeguard functions
|
|---|
| 488 |
|
|---|
| 489 | # 2.12.2
|
|---|
| 490 |
|
|---|
| 491 | **Bugfixes:**
|
|---|
| 492 |
|
|---|
| 493 | * `endsControlFlow`
|
|---|
| 494 | * added missing logic for labeled statement, iteration statements and try-catch
|
|---|
| 495 | * added missing logic for `break` and `continue` with labels
|
|---|
| 496 | * take all jump statements into account, not only the last statement
|
|---|
| 497 | * `isValidIdentifier` and `isValidNumericLiteral` handle irregular whitespace
|
|---|
| 498 | * `findImports` searches in ambient modules inside regular `.ts` files (not only `.d.ts`)
|
|---|
| 499 | * `canHaveJsDoc` is now a typeguard
|
|---|
| 500 |
|
|---|
| 501 | # 2.12.1
|
|---|
| 502 |
|
|---|
| 503 | **Bugfixes:**
|
|---|
| 504 |
|
|---|
| 505 | * `forEachTokenWithTrivia`
|
|---|
| 506 | * handles irregular whitespace and no longer visits some tokens twice
|
|---|
| 507 | * correctly calculates the range of JsxText
|
|---|
| 508 |
|
|---|
| 509 | # 2.12.0
|
|---|
| 510 |
|
|---|
| 511 | **API-Changes:**
|
|---|
| 512 |
|
|---|
| 513 | * deprecated `ImportOptions` if favor of the new `ImportKind` enum
|
|---|
| 514 |
|
|---|
| 515 | # 2.11.2
|
|---|
| 516 |
|
|---|
| 517 | **Bugfixes:**
|
|---|
| 518 |
|
|---|
| 519 | * `parseJsDocOfNode`: set correct `pos`, `end` and `parent` properties. Also affects `getJsDoc` of `EndOfFileToken`
|
|---|
| 520 |
|
|---|
| 521 | # 2.11.1
|
|---|
| 522 |
|
|---|
| 523 | **Bugfixes:**
|
|---|
| 524 |
|
|---|
| 525 | * `collectVariableUsage`: correctly consider catch binding as block scoped declaration inside catch block
|
|---|
| 526 |
|
|---|
| 527 | # 2.11.0
|
|---|
| 528 |
|
|---|
| 529 | **Bugfixes:**
|
|---|
| 530 |
|
|---|
| 531 | * `getJsDoc` now correctly returns JsDoc for `EndOfFileToken`
|
|---|
| 532 |
|
|---|
| 533 | **Features:**
|
|---|
| 534 |
|
|---|
| 535 | * added utility `parseJsDocOfNode`
|
|---|
| 536 |
|
|---|
| 537 | # 2.10.0
|
|---|
| 538 |
|
|---|
| 539 | **Features:**
|
|---|
| 540 |
|
|---|
| 541 | * added utility `findImports` to find all kinds of imports in a source file
|
|---|
| 542 |
|
|---|
| 543 | # 2.9.0
|
|---|
| 544 |
|
|---|
| 545 | **Features:**
|
|---|
| 546 |
|
|---|
| 547 | * added typeguard `isMappedTypeNode`
|
|---|
| 548 | * added utilities `canHaveJsDoc` and `getJsDoc`
|
|---|
| 549 |
|
|---|
| 550 | # 2.8.2
|
|---|
| 551 |
|
|---|
| 552 | **Bugfixes:**
|
|---|
| 553 |
|
|---|
| 554 | * `collectVariableUsage`: handle global augmentation like other module augmentations
|
|---|
| 555 |
|
|---|
| 556 | # 2.8.1
|
|---|
| 557 |
|
|---|
| 558 | **Bugfixes:**
|
|---|
| 559 |
|
|---|
| 560 | * Support `typescript@2.5.1` with optional catch binding
|
|---|
| 561 | * `collectVariableUsage` fixed a bug where method decorator had method's parameters in scope
|
|---|
| 562 |
|
|---|
| 563 | # 2.8.0
|
|---|
| 564 |
|
|---|
| 565 | * Compatibility with the latest typescript nightly
|
|---|
| 566 | * Added `getIdentifierText` to unescape identifiers across typescript versions
|
|---|
| 567 |
|
|---|
| 568 | # 2.7.1
|
|---|
| 569 |
|
|---|
| 570 | **Bugfixes:**
|
|---|
| 571 |
|
|---|
| 572 | * `isReassignmentTarget` don't return `true` for right side of assignment
|
|---|
| 573 |
|
|---|
| 574 | # 2.7.0
|
|---|
| 575 |
|
|---|
| 576 | **Features:**
|
|---|
| 577 |
|
|---|
| 578 | * Added `isReassignmentTarget` utility
|
|---|
| 579 |
|
|---|
| 580 | # 2.6.1
|
|---|
| 581 |
|
|---|
| 582 | **Bugfixes:**
|
|---|
| 583 |
|
|---|
| 584 | * `getDeclarationDomain` now returns `undefined` for Parameter in IndexSignature
|
|---|
| 585 | * `collectVariableUsage` ignores Parameter in IndexSignature
|
|---|
| 586 |
|
|---|
| 587 | # 2.6.0
|
|---|
| 588 |
|
|---|
| 589 | **Bugfixes:**
|
|---|
| 590 |
|
|---|
| 591 | * `collectVariableUsage`:
|
|---|
| 592 | * don't merge imports with global declarations
|
|---|
| 593 | * treat everything in a declaration file as exported if there is no explicit `export {};`
|
|---|
| 594 | * `isExpressionValueUsed`: handle destructuring in `for...of`
|
|---|
| 595 |
|
|---|
| 596 | **Features:**
|
|---|
| 597 |
|
|---|
| 598 | * Added `getModifier` utility
|
|---|
| 599 | * Added `DeclarationDomain.Import` to distinguish imports from other declarations
|
|---|
| 600 |
|
|---|
| 601 | # 2.5.1
|
|---|
| 602 |
|
|---|
| 603 | **Bugfixes:**
|
|---|
| 604 |
|
|---|
| 605 | * `collectVariableUsage` ignore jump labels as in `break label;`
|
|---|
| 606 |
|
|---|
| 607 | # 2.5.0
|
|---|
| 608 |
|
|---|
| 609 | **Bugfixes:**
|
|---|
| 610 |
|
|---|
| 611 | * `isFunctionWithBody` handles constructor overload correctly.
|
|---|
| 612 |
|
|---|
| 613 | **Features:**
|
|---|
| 614 |
|
|---|
| 615 | * Implemented `isExpressionValueUsed` to check whether the result of an expression is actually used.
|
|---|
| 616 | * Implemented `getDeclarationDomain` to determine if a given declaration introduces a new symbol in the value or type domain.
|
|---|
| 617 |
|
|---|
| 618 | **`collectVariableUses` is now usable**
|
|---|
| 619 |
|
|---|
| 620 | * no longer ignores signatures and its parameters
|
|---|
| 621 | * don't merge declarations and uses across domains
|
|---|
| 622 | * no longer marks exceptions in catch clause or parameter properties as exported
|
|---|
| 623 | * fixed exports of namespaces
|
|---|
| 624 | * fixed scoping of ClassExpression name
|
|---|
| 625 | * correcly handle ambient namespaces and module augmentations
|
|---|
| 626 | * fixed how `: typeof foo` is handled for parameters and function return type
|
|---|
| 627 | * **still WIP**: `export {Foo as Bar}` inside ambient namespaces and modules
|
|---|
| 628 |
|
|---|
| 629 | # 2.4.0
|
|---|
| 630 |
|
|---|
| 631 | **Bugfixes:**
|
|---|
| 632 |
|
|---|
| 633 | * `getLineRanges`: `contentLength` now contains the correct line length when there are multiple consecutive line break characters
|
|---|
| 634 | * `getTokenAtPosition`: don't match tokens that end at the specified position (because that's already outside of their range)
|
|---|
| 635 | * deprecated the misnamed `isModfierFlagSet`, use the new `isModifierFlagSet` instead
|
|---|
| 636 |
|
|---|
| 637 | **Features:**
|
|---|
| 638 |
|
|---|
| 639 | * Added typeguard: `isJsDoc`
|
|---|
| 640 | * Added experimental scope and usage analysis (`getUsageDomain` and `collectVariableUsage`)
|
|---|
| 641 |
|
|---|
| 642 | # 2.3.0
|
|---|
| 643 |
|
|---|
| 644 | **Bugfixes:**
|
|---|
| 645 |
|
|---|
| 646 | * `forEachComment` no longer omits some comments when callback returns a truthy value
|
|---|
| 647 | * `isPositionInComment` fixed false positive inside JSXText
|
|---|
| 648 |
|
|---|
| 649 | **Features:**
|
|---|
| 650 |
|
|---|
| 651 | * Added utility: `getCommentAtPosition`
|
|---|
| 652 |
|
|---|
| 653 | # 2.2.0
|
|---|
| 654 |
|
|---|
| 655 | **Bugfixes:**
|
|---|
| 656 |
|
|---|
| 657 | * Fixed bit value of `SideEffectOptions.JsxElement` to be a power of 2
|
|---|
| 658 |
|
|---|
| 659 | **Features:**
|
|---|
| 660 |
|
|---|
| 661 | * Added utilities: `getTokenAtPosition` and `isPositionInComment`
|
|---|
| 662 |
|
|---|
| 663 | # 2.1.0
|
|---|
| 664 |
|
|---|
| 665 | **Features:**
|
|---|
| 666 |
|
|---|
| 667 | * Added typeguard `isExpression`
|
|---|
| 668 | * Added utilities: `hasSideEffects`, `getDeclarationOfBindingElement`
|
|---|
| 669 |
|
|---|
| 670 | # 2.0.0
|
|---|
| 671 |
|
|---|
| 672 | **Breaking Changes:**
|
|---|
| 673 |
|
|---|
| 674 | * Dropped compatibility with `typescript@<2.1.0`
|
|---|
| 675 | * Removed misnamed `isNumericliteral`, use `isNumericLiteral` instead (notice the uppercase L)
|
|---|
| 676 | * Removed `isEnumLiteralType` which will cause compile errors with typescript@2.4.0
|
|---|
| 677 | * Refactored directory structure: all imports that referenced subdirectories (e.g. `require('tsutils/src/typeguard')` will be broken
|
|---|
| 678 |
|
|---|
| 679 | **Features:**
|
|---|
| 680 |
|
|---|
| 681 | * New directory structure allows imports of typeguards or utils independently, e.g. (`require('tsutils/typeguard')`)
|
|---|
| 682 |
|
|---|
| 683 | # 1.9.1
|
|---|
| 684 |
|
|---|
| 685 | **Bugfixes:**
|
|---|
| 686 |
|
|---|
| 687 | * `isObjectFlagSet` now uses the correct `objectFlags` property
|
|---|
| 688 |
|
|---|
| 689 | # 1.9.0
|
|---|
| 690 |
|
|---|
| 691 | **Bugfixes:**
|
|---|
| 692 |
|
|---|
| 693 | * `getNextToken` no longer omits `EndOfFileToken` when there is no trivia before EOF. That means the only inputs where `getNextToken` returns `undefined` are `SourceFile` and `EndOfFileToken`
|
|---|
| 694 |
|
|---|
| 695 | **Features**:
|
|---|
| 696 |
|
|---|
| 697 | * Added typeguards for types
|
|---|
| 698 | * Added utilities for flag checking: `isNodeFlagSet`, `isTypeFlagSet`, `isSymbolFlagSet`,`isObjectFlagSet`, `isModifierFlagSet`
|
|---|
| 699 |
|
|---|
| 700 | # 1.8.0
|
|---|
| 701 |
|
|---|
| 702 | **Features:**
|
|---|
| 703 |
|
|---|
| 704 | * Support peer dependency of typescript nightlies of 2.4.0
|
|---|
| 705 | * Added typeguards: `isJsxAttributes`, `isIntersectionTypeNode`, `isTypeOperatorNode`, `isTypePredicateNode`, `isTypeQueryNode`, `isUnionTypeNode`
|
|---|
| 706 |
|
|---|
| 707 | # 1.7.0
|
|---|
| 708 |
|
|---|
| 709 | **Bugfixes:**
|
|---|
| 710 |
|
|---|
| 711 | * `isFunctionScopeBoundary` now handles Interfaces, TypeAliases, FunctionSignatures, etc
|
|---|
| 712 |
|
|---|
| 713 | **Features:**
|
|---|
| 714 |
|
|---|
| 715 | * Added utilities: `isThisParameter`, `isSameLine` and `isFunctionWithBody`
|
|---|
| 716 |
|
|---|
| 717 | # 1.6.0
|
|---|
| 718 |
|
|---|
| 719 | **Features:**
|
|---|
| 720 |
|
|---|
| 721 | * Add `isValidPropertyAccess`, `isValidNumericLiteral` and `isValidPropertyName`
|
|---|
| 722 |
|
|---|
| 723 | # 1.5.0
|
|---|
| 724 |
|
|---|
| 725 | **Features:**
|
|---|
| 726 |
|
|---|
| 727 | * Add `isValidIdentifier`
|
|---|
| 728 |
|
|---|
| 729 | # 1.4.0
|
|---|
| 730 |
|
|---|
| 731 | **Features:**
|
|---|
| 732 |
|
|---|
| 733 | * Add `contentLength` property to the result of `getLineRanges`
|
|---|
| 734 |
|
|---|
| 735 | # 1.3.0
|
|---|
| 736 |
|
|---|
| 737 | **Bugfixes:**
|
|---|
| 738 |
|
|---|
| 739 | * `canHaveLeadingTrivia`:
|
|---|
| 740 | * Fix property access on undefined parent reference
|
|---|
| 741 | * Fixes: [palantir/tslint#2330](https://github.com/palantir/tslint/issues/2330)
|
|---|
| 742 | * `hasOwnThisReference`: now includes accessors on object literals
|
|---|
| 743 |
|
|---|
| 744 | **Features:**
|
|---|
| 745 |
|
|---|
| 746 | * Typeguards:
|
|---|
| 747 | * isTypeParameterDeclaration
|
|---|
| 748 | * isEnitityName
|
|---|
| 749 |
|
|---|
| 750 | # 1.2.2
|
|---|
| 751 |
|
|---|
| 752 | **Bugfixes:**
|
|---|
| 753 |
|
|---|
| 754 | * `hasOwnThisReference`:
|
|---|
| 755 | * exclude overload signatures of function declarations
|
|---|
| 756 | * add method declarations on object literals
|
|---|
| 757 |
|
|---|
| 758 | # 1.2.1
|
|---|
| 759 |
|
|---|
| 760 | **Bugfixes:**
|
|---|
| 761 |
|
|---|
| 762 | * Fix name of `isNumericLiteral`
|
|---|
| 763 |
|
|---|
| 764 | # 1.2.0
|
|---|
| 765 |
|
|---|
| 766 | **Features:**
|
|---|
| 767 |
|
|---|
| 768 | * Typeguards:
|
|---|
| 769 | * isEnumMember
|
|---|
| 770 | * isExpressionWithTypeArguments
|
|---|
| 771 | * isImportSpecifier
|
|---|
| 772 | * Utilities:
|
|---|
| 773 | * isJsDocKind, isTypeNodeKind
|
|---|
| 774 | * Allow typescript@next in peerDependencies
|
|---|
| 775 |
|
|---|
| 776 | # 1.1.0
|
|---|
| 777 |
|
|---|
| 778 | **Bugfixes:**
|
|---|
| 779 |
|
|---|
| 780 | * Fix isBlockScopeBoundary: Remove WithStatement, IfStatment, DoStatement and WhileStatement because they are no scope boundary whitout a block.
|
|---|
| 781 |
|
|---|
| 782 | **Features:**
|
|---|
| 783 |
|
|---|
| 784 | * Added more typeguards:
|
|---|
| 785 | * isAssertionExpression
|
|---|
| 786 | * isEmptyStatement
|
|---|
| 787 | * isJsxAttributeLike
|
|---|
| 788 | * isJsxOpeningLikeElement
|
|---|
| 789 | * isNonNullExpression
|
|---|
| 790 | * isSyntaxList
|
|---|
| 791 | * Utilities:
|
|---|
| 792 | * getNextToken, getPreviousToken
|
|---|
| 793 | * hasOwnThisReference
|
|---|
| 794 | * getLineRanges
|
|---|
| 795 |
|
|---|
| 796 | # 1.0.0
|
|---|
| 797 |
|
|---|
| 798 | **Features:**
|
|---|
| 799 |
|
|---|
| 800 | * Initial implementation of typeguards
|
|---|
| 801 | * Utilities:
|
|---|
| 802 | * getChildOfKind
|
|---|
| 803 | * isNodeKind, isAssignmentKind
|
|---|
| 804 | * hasModifier, isParameterProperty, hasAccessModifier
|
|---|
| 805 | * getPreviousStatement, getNextStatement
|
|---|
| 806 | * getPropertyName
|
|---|
| 807 | * forEachDestructuringIdentifier, forEachDeclaredVariable
|
|---|
| 808 | * getVariableDeclarationKind, isBlockScopedVariableDeclarationList, isBlockScopedVariableDeclaration
|
|---|
| 809 | * isScopeBoundary, isFunctionScopeBoundary, isBlockScopeBoundary
|
|---|
| 810 | * forEachToken, forEachTokenWithTrivia, forEachComment
|
|---|
| 811 | * endsControlFlow
|
|---|