File: tsxStatelessFunctionComponentOverload1.errors.txt

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (49 lines) | stat: -rw-r--r-- 2,408 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
tests/cases/conformance/jsx/file.tsx(17,39): error TS2842: 'string' is an unused renaming of 'y1'. Did you intend to use it as a type annotation?


==== tests/cases/conformance/jsx/file.tsx (1 errors) ====
    import React = require('react')
    
    declare function OneThing(k: {yxx: string}): JSX.Element;
    declare function OneThing(k: {yxx1: string, children: string}): JSX.Element;
    declare function OneThing(l: {yy: number, yy1: string}): JSX.Element;
    declare function OneThing(l: {yy: number, yy1: string, yy2: boolean}): JSX.Element;
    declare function OneThing(l1: {data: string, "data-prop": boolean}): JSX.Element;
    
    // OK
    const c1 = <OneThing yxx='ok' />
    const c2 = <OneThing yy={100}  yy1="hello"/>
    const c3 = <OneThing yxx="hello" ignore-prop />
    const c4 = <OneThing data="hello" data-prop />
    const c5 = <OneThing yxx1='ok'>Hello</OneThing>
    
    
    declare function TestingOneThing({y1: string}): JSX.Element;
                                          ~~~~~~
!!! error TS2842: 'string' is an unused renaming of 'y1'. Did you intend to use it as a type annotation?
!!! related TS2843 tests/cases/conformance/jsx/file.tsx:17:46: We can only write a type for 'y1' by adding a type for the entire parameter here.
    declare function TestingOneThing(j: {"extra-data": string, yy?: string}): JSX.Element;
    declare function TestingOneThing(n: {yy: number, direction?: number}): JSX.Element;
    declare function TestingOneThing(n: {yy: string, name: string}): JSX.Element;
    
    // OK
    const d1 = <TestingOneThing y1 extra-data />;
    const d2 = <TestingOneThing extra-data="hello" />;
    const d3 = <TestingOneThing extra-data="hello" yy="hihi" />;
    const d4 = <TestingOneThing extra-data="hello" yy={9} direction={10} />;
    const d5 = <TestingOneThing extra-data="hello" yy="hello" name="Bob" />;
    
    
    declare function TestingOptional(a: {y1?: string, y2?: number}): JSX.Element;
    declare function TestingOptional(a: {y1: boolean, y2?: number, y3: boolean}): JSX.Element;
    
    // OK
    const e1 = <TestingOptional />
    const e3 = <TestingOptional y1="hello"/>
    const e4 = <TestingOptional y1="hello" y2={1000} />
    const e5 = <TestingOptional y1 y3/>
    const e6 = <TestingOptional y1 y3 y2={10} />
    const e2 = <TestingOptional y1 y3 extra-prop/>