https://github.com/Microsoft/TypeScript

sort by:
Revision Author Date Message Commit Date
795c53a JSDoc comment parsing supports multiline backticks Previously, backticks in JSDoc ended at the end of a line. This PR changes that so that backticks continue parsing until another backtick. Note that triple backticks and single backticks are treated the same way. The change is already very clunky, and I haven't thought about how much clunkier it would be to track backtick history in the parser. 07 September 2022, 18:45:40 UTC
b58721f Update package-lock.json 07 September 2022, 06:31:57 UTC
3c3820b Simplify CI detection (#50661) 06 September 2022, 23:36:37 UTC
9ac1fce Fix eslint not looking at certain scripts, fix lints (#50660) 06 September 2022, 23:05:47 UTC
fd05c0c Make useFsEvents as default strategy for the watching (#50366) * Remove unnecessary parameter * Dont store name unnecessarily in the watchers * Polled watches and not files * Use fs events as default watching * Some refactoring * Make single per directory native watchers now that we are using it as default * Rename * Comment 06 September 2022, 20:14:50 UTC
5c2f770 Remove unused cancellation from build (#50658) 06 September 2022, 19:43:06 UTC
66fbf05 Update package-lock.json 06 September 2022, 06:30:40 UTC
7910c50 Update package-lock.json 03 September 2022, 06:07:00 UTC
fd3a84c Report every instance of TS1208 (#50101) * Report every instance of TS1208 * Test case for multiple cases of TS1208 * Add test case for isolatedModules with moduleDetection forced 02 September 2022, 20:44:47 UTC
62f980a Check if its same buildinfo only for directly referenced projects and not recursively (#50617) Fixes #50545 02 September 2022, 20:38:00 UTC
856c7c5 Allow `{}` to narrow in same special cases as `unknown` (#50601) 02 September 2022, 16:47:27 UTC
854d448 `in` operator shouldn't narrow `{}` originating in `unknown` (#50610) * 'in' operator shouldn't narrow {} originating in unknown * Add regression test 02 September 2022, 16:30:17 UTC
549e61d Update package-lock.json 02 September 2022, 06:22:41 UTC
bcf9949 fix(50079): show deprecated on JSX attributes (#50084) 01 September 2022, 23:59:29 UTC
5df09a5 Use bidirectional comparability in narrowing (#50592) * Use bidirectional comparability (aka comparability) in narrowing * Rename test, check other CFA branch, test without strictNullChecks 01 September 2022, 21:26:48 UTC
891cdc5 Remove unused baselines (#50593) 01 September 2022, 19:48:28 UTC
6db2c88 {} & null and {} & undefined should always be never (#50553) * {} & null and {} & undefined should be never in non-strictNullChecks mode * Add tests * Address code review feedback * Accept new baselines 01 September 2022, 19:37:13 UTC
238c341 Defer distributing index over generic object types (#50540) * Defer distributing index over generic object types * Only check if the index type should be deferred for intersection types * Add an additional test case 01 September 2022, 14:28:13 UTC
2983092 Do not canonicalize the file names when getting absolute paths during nodenext resolution (#50557) * Add test to show how scope messes with casing * Do not canonicalize the file names when getting absolute paths Fixes #50544 * Unnecessary exports * Add test for self referencing package * Fix self reference package with casing 01 September 2022, 13:48:41 UTC
dcade77 Update package-lock.json 01 September 2022, 06:13:05 UTC
a9797d2 fix(50340): typeof ... === "undefined" check on discriminated union of undefined and object type doesn't narrow correctly (#50344) * fix(50340): narrow type by discriminant in typeof * add additional test cases 31 August 2022, 22:00:50 UTC
43f8ae6 Only normalize intersections that include {} (#50535) * Only normalize intersections that include {} * Accept new baselines 31 August 2022, 21:36:03 UTC
d293e72 Rename API to importPlugin (#50554) * Rename API to importPlugin * Make it internal too 31 August 2022, 21:21:56 UTC
19defbf Update package-lock.json 31 August 2022, 06:33:19 UTC
f071d30 Move contributing related info out of README to CONTRIBUTING (#50543) 30 August 2022, 19:13:11 UTC
488d0ee Retain name and propertyName in declaration emit copies of binding patterns if property name is a keyword (#50537) * Retain name and propertyName in declaration emit copies of binding patterns if property name is a keyword * Accept baselines * Remove out of date file 30 August 2022, 16:03:02 UTC
8b482b5 Update package-lock.json 30 August 2022, 06:29:59 UTC
c89f355 Remove redundant pretest script (#50518) 29 August 2022, 19:12:32 UTC
6d170b4 Handle intersections in isGenericTypeWithoutNullableConstraint (#50497) * Handle intersections in isGenericTypeWithoutNullableConstraint * Add regression test 29 August 2022, 16:24:13 UTC
ed6889c LEGO: Merge pull request 50506 LEGO: Merge pull request 50506 29 August 2022, 10:47:42 UTC
29cbfe9 LEGO: Merge pull request 50493 LEGO: Merge pull request 50493 28 August 2022, 10:32:25 UTC
6faa291 LEGO: Merge pull request 50484 LEGO: Merge pull request 50484 27 August 2022, 10:51:23 UTC
71b2ba6 Reuse computed type of condition expressions (#49881) 27 August 2022, 08:40:13 UTC
8778c1d Update package-lock.json 27 August 2022, 06:06:30 UTC
4579245 fix(50427): allow convert function expressions (#50430) 26 August 2022, 22:43:19 UTC
cbc0b17 Push package-lock.json updates via typescript-bot token (#50476) 26 August 2022, 21:36:25 UTC
bb3a7ae fix(50415): Language server debug failure - Did not expect GetAccessor to have an Identifier in its trivia (#50470) * fix(50415): clone props for get/set accessors * add additional tests * create helpers to create name, body, modifiers, typeName * cleanup 26 August 2022, 21:33:23 UTC
3557092 Rephrase error message to be 100% technically correct (#50471) 26 August 2022, 21:22:49 UTC
71d1911 add unknown to DateTimeFormatTypes (#50402) * add unknown to DateTimeFormatTypes * move unknown to es2019.intl instead * Accepted baselines. Co-authored-by: long.ho <long.ho@cloudkitchens.com> 26 August 2022, 20:02:44 UTC
8f89599 Don't include .gitattributes in package (#50475) 26 August 2022, 19:15:30 UTC
6e8337e Optimize substitution types (#50397) * Optimize substitution type infrastructure * Accept new baselines * Preserve instantiated substitution types for type variables * Restrictive type parameters should have no constraint * Fix issues from top100 test run * Accept new baselines 26 August 2022, 19:06:06 UTC
226dd0b Fix typechecking related lints that changed post 4.8, update LKG to 4.8.2 (#50472) 26 August 2022, 18:41:45 UTC
164dddc feat(7481): Operator to ensure an expression is contextually typed by, and satisfies, some type (#46827) * feat(7481): add explicit type compatibility check with 'satisfies' expression * Add failing test for lack of intersectioned contextual type * Implement the behavior * Add test corresponding to the 'if' * Add test based on defined scenarios * remove isExpression in favor of using type casting * move tests from compiler to conformance folder * update baseline * add missing contextFlags argument * use asserted type * accept baseline Co-authored-by: Ryan Cavanaugh <ryanca@microsoft.com> 26 August 2022, 17:05:52 UTC
0715791 Update package-lock.json 26 August 2022, 06:20:06 UTC
e675ea8 Remove AUTHORS.md, .mailmap, authors.ts script (#50410) 25 August 2022, 22:38:09 UTC
38076df Fix auto import crash due to difference in `paths` handling (#50419) 25 August 2022, 20:02:48 UTC
12eb519 fix(50435): Duplicate seeming Code Actions for convert const to let (#50442) * fix(50435): omit fix all in constToLet QF * add FixAll action 25 August 2022, 20:01:46 UTC
a08b045 Jsdoc property description (#50269) * jsdocPropertyDescription * jsdocPropertyDescription * jsdocPropertyDescription * Fixes #47933 * added additional test * added additional example * fixed bug * changed function to only grab the literal type * added additional condition for literals and symbols * added additional test cases * Update src/services/symbolDisplay.ts Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com> * addressed PR review * addressed new PR review Co-authored-by: Danay Fernandez Alfonso <t-danayf@microsoft.com> Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com> 25 August 2022, 18:57:32 UTC
5ba22e0 Remove top level loc folder (#50421) 25 August 2022, 18:44:24 UTC
c4eb37c Update package-lock.json 25 August 2022, 06:14:30 UTC
8d7ad8c fix(50375): Errors for missing enum-named properties should attempt to preserve names (#50382) * fix(50375): preserve enum-named properties * add AllowComputedPropertyEnums option * use bit shifting * rename AllowComputedPropertyEnum -> WriteComputedProps * mark WriteComputedProps as internal * mark symbolToNode as internal 24 August 2022, 18:54:44 UTC
fb717df Discard union types before considering weak type checks on unit-like types (#50423) * Only check isUnitType when dealing with non-unions. * Add test case. * Accepted baselines. 24 August 2022, 18:39:00 UTC
b9a5bbc Syntax operations also need to ensure project is present for the open script infos since update could be pending to make sure open script info has project (#50418) Also convert one relevant test case to baseline Fixes #50131 24 August 2022, 17:28:23 UTC
1d4fbbb Update package-lock.json 24 August 2022, 06:08:31 UTC
44ce3cf fix(50224): Intellisense for strings within a type's Union doesn't work properly for JSX (#50231) * fix(50224): show string literal completions in JsxAttributeInitializer * add feedback changes 23 August 2022, 21:59:10 UTC
6ee5db9 Use package.json files array instead of .npmignore (#50408) 23 August 2022, 21:14:20 UTC
f88117d Update package-lock.json 23 August 2022, 06:14:21 UTC
12c3255 Split CI linting/playwright out into separate jobs (#50406) 23 August 2022, 00:42:29 UTC
4605d89 Use a mapped type to enforce type-safety on `forEachChild`. (#50409) 23 August 2022, 00:30:44 UTC
6362fb2 Replace eslint rulesdir with eslint-plugin-local, convert eslint rules to JS (#50380) 22 August 2022, 20:46:03 UTC
aaa4f9d Make canHaveModifiers/Decorators public (#50399) 22 August 2022, 19:01:17 UTC
3f7ff15 Update package-lock.json 22 August 2022, 06:08:09 UTC
76357ba Swap `forEachChild` to use a table of functions instead of a `switch` statement. (#50225) * Swap `forEachChild` to use an array of functions instead of a `switch` statement. * Let's see if 'new' changes anything. * Co-locate each assignment into `forEachChildTable`. * Try `push`ing undefined to create a packed Array. * Try using an unconditional no-op function. * `forEach` -> `forEachChildIn` * Remove the optional chain if we are pre-filling with no-ops. * Grab function directly to avoid possible `.call` overhead from downlevel emit. * Swap to object literal. * Lints and formatting. 22 August 2022, 00:48:45 UTC
38e91fb LEGO: Merge pull request 50389 LEGO: Merge pull request 50389 21 August 2022, 10:07:27 UTC
7cab345 Update package-lock.json 21 August 2022, 06:07:14 UTC
50041bd Update package-lock.json 20 August 2022, 06:06:43 UTC
6cbb39b Re-caret dependencies so deps like eslint continue to be bumped (#50368) 19 August 2022, 19:58:54 UTC
284837d Fixes for `decorators` property deprecations (#50343) * Change type of deprecated 'decorators' property * fix 'Invalid Arguments' error for create/update constructor in factory * Update deprecation comments * Make 'decorators' optional and 'undefined' * Rename '_decorators' to 'illegalDecorators' * Update baselines 19 August 2022, 18:27:26 UTC
ef88fbb Remove some unused deps and dead code (#50367) 19 August 2022, 16:42:14 UTC
5969ae9 fix(50075): do not strip undefined from the function class properties (#50169) 19 August 2022, 16:34:42 UTC
05d7d6b Unify default import resolution across specifier target codepaths (#49814) * Unify default import resolution across specifier target codepaths * Use differing type aliases, per request 19 August 2022, 09:25:41 UTC
cb63d46 Update package-lock.json 19 August 2022, 06:07:20 UTC
1f0f7c8 If resolvedFileName differs with realPath only in casing use the resolvedFileName before realpath so that errors can be reported with forceConsistentCasingInFileNames (#50364) * Add tests when realpath supresses the casing error * Fix when real path results in value that differs only in case Fixes #49470 * Comment 18 August 2022, 21:51:46 UTC
ea36fb3 mark Intl.LocalesArgument as readonly (#50135) 18 August 2022, 21:38:41 UTC
1592210 Add a jump-table for visitEachChild (#50266) * Add a jump-table for visitEachChild * Name each visitor function for better stack traces * Fix node tests and some minor cleanup 18 August 2022, 19:03:17 UTC
7bafbea Add fourslash function for validating syntactic classification (#50362) 18 August 2022, 18:28:08 UTC
df25b77 Run eslint at root, rather than on src and scripts individually (#50327) 18 August 2022, 18:24:10 UTC
42165a1 LEGO: Merge pull request 50353 LEGO: Merge pull request 50353 18 August 2022, 10:12:12 UTC
66d8b95 Ensure all scripts are checked, fix errors (#50326) 17 August 2022, 23:42:50 UTC
15f7b6f LEGO: Merge pull request 50337 LEGO: Merge pull request 50337 17 August 2022, 10:02:07 UTC
745da27 Update package-lock.json 17 August 2022, 06:06:59 UTC
3b80ddc fix first match in `RegExpMatchArray` being possibly undefined when `noUncheckedIndexedAccess` is enabled (#49682) * fix first match in `RegExpMatchArray` being possibly undefined when `noUncheckedIndexedAccess` is enabled * fix tests * add test Co-authored-by: DetachHead <detachhead@users.noreply.github.com> Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> 16 August 2022, 17:12:12 UTC
330e33c Ignore related info in diagnostic deduplication (#50309) * Ignore related info in diagnostic deduplication * Add another test 16 August 2022, 16:28:59 UTC
f24f74e 🔨 Fix missing "Implement interface" code fix for mapped types with implicit `keyof T` in their definition (#49999) * ⚗️ Add test to verify code fix works when implementing a mapped type with indirect keyof Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com> * 🔨 Add property as implementation for symbols that has no declaration Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com> diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index 94b64e57..a4c11fd5 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -60,21 +60,19 @@ namespace ts.codefix { isAmbient = false, ): void { const declarations = symbol.getDeclarations(); - if (!(declarations && declarations.length)) { - return undefined; - } + const declaration = declarations ? declarations[0] : undefined; const checker = context.program.getTypeChecker(); const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions()); - const declaration = declarations[0]; + const kind = declaration?.kind ?? SyntaxKind.PropertySignature; const name = getSynthesizedDeepClone(getNameOfDeclaration(declaration), /*includeTrivia*/ false) as PropertyName; - const visibilityModifier = createVisibilityModifier(getEffectiveModifierFlags(declaration)); + const visibilityModifier = createVisibilityModifier(declaration ? getEffectiveModifierFlags(declaration) : ModifierFlags.None); const modifiers = visibilityModifier ? factory.createNodeArray([visibilityModifier]) : undefined; const type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); const optional = !!(symbol.flags & SymbolFlags.Optional); const ambient = !!(enclosingDeclaration.flags & NodeFlags.Ambient) || isAmbient; const quotePreference = getQuotePreference(sourceFile, preferences); - switch (declaration.kind) { + switch (kind) { case SyntaxKind.PropertySignature: case SyntaxKind.PropertyDeclaration: const flags = quotePreference === QuotePreference.Single ? NodeBuilderFlags.UseSingleQuotesForStringLiteralType : undefined; @@ -88,13 +86,16 @@ namespace ts.codefix { } addClassElement(factory.createPropertyDeclaration( modifiers, - name, + declaration ? name : symbol.getName(), optional && (preserveOptional & PreserveOptionalFlags.Property) ? factory.createToken(SyntaxKind.QuestionToken) : undefined, typeNode, /*initializer*/ undefined)); break; case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: { + if (!declarations) { + break; + } let typeNode = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context)); const allAccessors = getAllAccessorDeclarations(declarations, declaration as AccessorDeclaration); const orderedAccessors = allAccessors.secondAccessor @@ -138,6 +139,10 @@ namespace ts.codefix { // If there is more than one overload but no implementation signature // (eg: an abstract method or interface declaration), there is a 1-1 // correspondence of declarations and signatures. + if (!declarations) { + break; + } + const signatures = checker.getSignaturesOfType(type, SignatureKind.Call); if (!some(signatures)) { break; * 🔨 Improve code readability Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com> diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index 2f5c8703ab..aea0206a8a 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -60,7 +60,7 @@ namespace ts.codefix { isAmbient = false, ): void { const declarations = symbol.getDeclarations(); - const declaration = declarations ? declarations[0] : undefined; + const declaration = declarations?.[0]; const checker = context.program.getTypeChecker(); const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions()); const kind = declaration?.kind ?? SyntaxKind.PropertySignature; @@ -93,9 +93,7 @@ namespace ts.codefix { break; case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: { - if (!declarations) { - break; - } + Debug.assertIsDefined(declarations); let typeNode = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context)); const allAccessors = getAllAccessorDeclarations(declarations, declaration as AccessorDeclaration); const orderedAccessors = allAccessors.secondAccessor @@ -139,10 +137,7 @@ namespace ts.codefix { // If there is more than one overload but no implementation signature // (eg: an abstract method or interface declaration), there is a 1-1 // correspondence of declarations and signatures. - if (!declarations) { - break; - } - + Debug.assertIsDefined(declarations); const signatures = type.isUnion() ? flatMap(type.types, t => t.getCallSignatures()) : type.getCallSignatures(); if (!some(signatures)) { break; * 📜 Add comment regarding mapped type children's missing declaration Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com> Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com> Co-authored-by: Andrew Branch <andrew@wheream.io> 16 August 2022, 16:27:29 UTC
90fa1c7 Update baseline after out-of-order merge (#50320) 16 August 2022, 15:54:55 UTC
9767f51 Update package-lock.json 16 August 2022, 06:06:30 UTC
4e33e0e Make literal types not comparable to weak object types without property overlap (#49865) 16 August 2022, 00:10:11 UTC
64ee1e8 Strip literal freshness of contextually typed literals (#49884) * Strip literal freshness of contextually typed literals * Add more tests 16 August 2022, 00:04:09 UTC
9c1baee On windows handle the long paths in realpathSync.native (#50306) Fixes #49470 15 August 2022, 23:57:47 UTC
e989d84 Forward intersectionState flag when comparing indexed access constraints (#50261) 15 August 2022, 23:10:32 UTC
8a873de fix(49149): remove unneeded array overload to Object.freeze (#50029) * fix(49149): remove unneeded array overload to Object.freeze * chore: commit baseline changes Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Co-authored-by: Andrew Branch <andrew@wheream.io> 15 August 2022, 23:10:02 UTC
61d8a8d fix(49629): fix crash in find-all-refs when using module.exports/export= with arrays/primitives (#50291) 15 August 2022, 22:14:26 UTC
bc52ff6 Make `React` import fix not block component import fix (#50307) * Stop React import fix from blocking component import fixes * Add additional promote-type-only test 15 August 2022, 20:13:41 UTC
fd3c46b Fix export = error message to not have redundant language (#50308) 15 August 2022, 20:13:33 UTC
9f7c0cb Run ESLint over our JS files, fix all lints (#50172) 15 August 2022, 15:42:26 UTC
03b12a6 LEGO: Merge pull request 50298 LEGO: Merge pull request 50298 14 August 2022, 10:10:53 UTC
656d6a5 Update package-lock.json 14 August 2022, 06:06:50 UTC
7f5600e LEGO: Merge pull request 50295 LEGO: Merge pull request 50295 13 August 2022, 12:07:02 UTC
adf26ff Revert "Fixed an issue with contextual type for intersection properties (#48668)" (#50279) This reverts commit 9236e39374c0ec9a1e3f9894af4fb9eb34ba0021. 12 August 2022, 17:24:50 UTC
8783da8 Update package-lock.json 12 August 2022, 06:06:46 UTC
back to top