diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 086f581e153..d0780406f11 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3607,7 +3607,7 @@ namespace ts { function symbolToParameterDeclaration(parameterSymbol: Symbol, context: NodeBuilderContext, preserveModifierFlags?: boolean): ParameterDeclaration { const parameterDeclaration = getDeclarationOfKind(parameterSymbol, SyntaxKind.Parameter); - Debug.assert(!!parameterDeclaration || isTransientSymbol(parameterSymbol) && !!parameterSymbol.isRestParameter); + Debug.assert(!!parameterDeclaration || isTransientSymbol(parameterSymbol)); let parameterType = getTypeOfSymbol(parameterSymbol); if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) { @@ -3616,7 +3616,8 @@ namespace ts { const parameterTypeNode = typeToTypeNodeHelper(parameterType, context); const modifiers = !(context.flags & NodeBuilderFlags.OmitParameterModifiers) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers && parameterDeclaration.modifiers.map(getSynthesizedClone); - const dotDotDotToken = !parameterDeclaration || isRestParameter(parameterDeclaration) ? createToken(SyntaxKind.DotDotDotToken) : undefined; + const isRest = parameterDeclaration ? isRestParameter(parameterDeclaration) : (parameterSymbol as TransientSymbol).isRestParameter; + const dotDotDotToken = isRest ? createToken(SyntaxKind.DotDotDotToken) : undefined; const name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === SyntaxKind.Identifier ? diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 459b4b12d83..bb3560cbde5 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -2123,7 +2123,7 @@ namespace ts.server { } private telemetryOnOpenFile(scriptInfo: ScriptInfo): void { - if (!this.eventHandler || !scriptInfo.isJavaScript() || !addToSeen(this.allJsFilesForOpenFileTelemetry, scriptInfo.path)) { + if (this.syntaxOnly || !this.eventHandler || !scriptInfo.isJavaScript() || !addToSeen(this.allJsFilesForOpenFileTelemetry, scriptInfo.path)) { return; } diff --git a/tests/cases/fourslash/codeFixInferFromUsageJSXElement.ts b/tests/cases/fourslash/codeFixInferFromUsageJSXElement.ts new file mode 100644 index 00000000000..250673d91fc --- /dev/null +++ b/tests/cases/fourslash/codeFixInferFromUsageJSXElement.ts @@ -0,0 +1,40 @@ +/// + +// @noImplicitAny: true +// @jsx: react +// @module: es2015 +// @moduleResolution: node + +// @Filename: /node_modules/@types/react/index.d.ts +////export = React; +////export as namespace React; +////declare namespace React { +//// export class Component { render(): JSX.Element | null; } +////} +////declare global { +//// namespace JSX { +//// interface Element {} +//// } +////} + + +// @filename: a.tsx +//// import React from 'react'; +//// +//// export default function Component([|props |]) { +//// if (props.isLoading) { +//// return
...Loading < /div>; +//// } +//// else { +//// return { +//// return props.update(rec); +//// } +//// } +//// />; +//// } +//// } + + +verify.rangeAfterCodeFix("props: { isLoading: any; update: (arg0: any) => void; }",/*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 0); \ No newline at end of file diff --git a/tests/cases/fourslash/jsxWithTypeParametershasInstantiatedSignatureHelp.tsx b/tests/cases/fourslash/jsxWithTypeParametershasInstantiatedSignatureHelp.tsx index e317fe338ed..71859594cea 100644 --- a/tests/cases/fourslash/jsxWithTypeParametershasInstantiatedSignatureHelp.tsx +++ b/tests/cases/fourslash/jsxWithTypeParametershasInstantiatedSignatureHelp.tsx @@ -14,6 +14,6 @@ //// (/>); goTo.marker("1"); -verify.currentSignatureHelpIs("SFC(_props: Record): string"); +verify.signatureHelp({ text: "SFC(_props: Record): string" }); goTo.marker("2"); -verify.currentSignatureHelpIs("SFC(_props: Record): string"); +verify.signatureHelp({ text: "SFC(_props: Record): string" });