Skip to content

Commit 56f31c3

Browse files
author
Kanchalai Tanglertsampan
committed
Address code review
1 parent aea551c commit 56f31c3

6 files changed

+4
-139
lines changed

tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.errors.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ tests/cases/conformance/types/contextualTypes/jsxAttributes/file.tsx(37,25): err
4040
return this._buildMainButton(props);
4141
}
4242

43-
const b0 = <MainButton {...{onClick: (k) => {console.log(k)}}} extra />; // k has type any
43+
const b0 = <MainButton {...{onClick: (k) => {console.log(k)}}} extra />; // k has type "left" | "right"
4444
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4545
!!! error TS2322: Type '{ extra: true; onClick: (k: "left" | "right") => void; }' is not assignable to type 'IntrinsicAttributes & LinkProps'.
4646
!!! error TS2322: Property 'extra' does not exist on type 'IntrinsicAttributes & LinkProps'.

tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes02.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function MainButton(props: ButtonProps | LinkProps): JSX.Element {
2626
return this._buildMainButton(props);
2727
}
2828

29-
const b0 = <MainButton {...{onClick: (k) => {console.log(k)}}} extra />; // k has type any
29+
const b0 = <MainButton {...{onClick: (k) => {console.log(k)}}} extra />; // k has type "left" | "right"
3030
const b2 = <MainButton onClick={(k)=>{console.log(k)}} extra />; // k has type "left" | "right"
3131
const b3 = <MainButton {...{goTo:"home"}} extra />; // goTo has type"home" | "contact"
3232
const b4 = <MainButton goTo="home" extra />; // goTo has type "home" | "contact"
@@ -49,7 +49,7 @@ define(["require", "exports", "react"], function (require, exports, React) {
4949
return this._buildMainButton(props);
5050
}
5151
exports.MainButton = MainButton;
52-
var b0 = <MainButton {...{ onClick: function (k) { console.log(k); } }} extra/>; // k has type any
52+
var b0 = <MainButton {...{ onClick: function (k) { console.log(k); } }} extra/>; // k has type "left" | "right"
5353
var b2 = <MainButton onClick={function (k) { console.log(k); }} extra/>; // k has type "left" | "right"
5454
var b3 = <MainButton {...{ goTo: "home" }} extra/>; // goTo has type"home" | "contact"
5555
var b4 = <MainButton goTo="home" extra/>; // goTo has type "home" | "contact"

tests/baselines/reference/tsxSpreadAttributesResolution7.symbols

-62
This file was deleted.

tests/baselines/reference/tsxSpreadAttributesResolution7.types

-72
This file was deleted.

tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes02.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function MainButton(props: ButtonProps | LinkProps): JSX.Element {
3030
return this._buildMainButton(props);
3131
}
3232

33-
const b0 = <MainButton {...{onClick: (k) => {console.log(k)}}} extra />; // k has type any
33+
const b0 = <MainButton {...{onClick: (k) => {console.log(k)}}} extra />; // k has type "left" | "right"
3434
const b2 = <MainButton onClick={(k)=>{console.log(k)}} extra />; // k has type "left" | "right"
3535
const b3 = <MainButton {...{goTo:"home"}} extra />; // goTo has type"home" | "contact"
3636
const b4 = <MainButton goTo="home" extra />; // goTo has type "home" | "contact"

tests/cases/fourslash/tsxSignatureHelp2.ts

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
//// let e1 = <MainButton/*1*/ /*2*/
3232

3333
goTo.marker("1");
34-
// The second overload is chosen because the first doesn't get selected by choose overload as it has incorrect arity
3534
verify.signatureHelpCountIs(2);
3635
verify.currentSignatureHelpIs("MainButton(buttonProps: ButtonProps): any");
3736
verify.currentParameterSpanIs("buttonProps: ButtonProps");

0 commit comments

Comments
 (0)