mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 18:04:18 -05:00
Merge branch 'master' into updateVersion
This commit is contained in:
@@ -3607,7 +3607,7 @@ namespace ts {
|
||||
|
||||
function symbolToParameterDeclaration(parameterSymbol: Symbol, context: NodeBuilderContext, preserveModifierFlags?: boolean): ParameterDeclaration {
|
||||
const parameterDeclaration = getDeclarationOfKind<ParameterDeclaration>(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 ?
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
40
tests/cases/fourslash/codeFixInferFromUsageJSXElement.ts
Normal file
40
tests/cases/fourslash/codeFixInferFromUsageJSXElement.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @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 <div>...Loading < /div>;
|
||||
//// }
|
||||
//// else {
|
||||
//// return <AnotherComponent
|
||||
//// update={
|
||||
//// (rec) => {
|
||||
//// return props.update(rec);
|
||||
//// }
|
||||
//// }
|
||||
//// />;
|
||||
//// }
|
||||
//// }
|
||||
|
||||
|
||||
verify.rangeAfterCodeFix("props: { isLoading: any; update: (arg0: any) => void; }",/*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 0);
|
||||
@@ -14,6 +14,6 @@
|
||||
//// (</*2*/SFC<string>/>);
|
||||
|
||||
goTo.marker("1");
|
||||
verify.currentSignatureHelpIs("SFC(_props: Record<string, {}>): string");
|
||||
verify.signatureHelp({ text: "SFC(_props: Record<string, {}>): string" });
|
||||
goTo.marker("2");
|
||||
verify.currentSignatureHelpIs("SFC(_props: Record<string, string>): string");
|
||||
verify.signatureHelp({ text: "SFC(_props: Record<string, string>): string" });
|
||||
|
||||
Reference in New Issue
Block a user