File: tsxSpreadAttributesResolution2.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 (53 lines) | stat: -rw-r--r-- 3,294 bytes parent folder | download | duplicates (4)
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
50
51
52
53
tests/cases/conformance/jsx/file.tsx(20,10): error TS2739: Type '{}' is missing the following properties from type 'PoisonedProp': x, y
tests/cases/conformance/jsx/file.tsx(21,10): error TS2739: Type '{}' is missing the following properties from type 'PoisonedProp': x, y
tests/cases/conformance/jsx/file.tsx(22,19): error TS2322: Type 'boolean' is not assignable to type 'string'.
tests/cases/conformance/jsx/file.tsx(22,21): error TS2322: Type 'true' is not assignable to type '"2"'.
tests/cases/conformance/jsx/file.tsx(23,10): error TS2322: Type '{ x: number; y: "2"; }' is not assignable to type 'PoisonedProp'.
  Types of property 'x' are incompatible.
    Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsx/file.tsx(24,40): error TS2322: Type '{ X: string; x: number; y: "2"; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'.
  Property 'X' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'. Did you mean 'x'?


==== tests/cases/conformance/jsx/file.tsx (6 errors) ====
    import React = require('react');
    
    interface PoisonedProp {
        x: string;
        y: "2";
    }
    
    class Poisoned extends React.Component<PoisonedProp, {}> {
        render() {
            return <div>Hello</div>;
        }
    }
    
    const obj = {};
    
    // OK
    <Poisoned {...{x: "ok", y: "2"}} />;
    
    // Error
    let p = <Poisoned {...obj} />;
             ~~~~~~~~
!!! error TS2739: Type '{}' is missing the following properties from type 'PoisonedProp': x, y
    let y = <Poisoned />;
             ~~~~~~~~
!!! error TS2739: Type '{}' is missing the following properties from type 'PoisonedProp': x, y
    let z = <Poisoned x y/>;
                      ~
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:4:5: The expected type comes from property 'x' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'
                        ~
!!! error TS2322: Type 'true' is not assignable to type '"2"'.
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:5:5: The expected type comes from property 'y' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'
    let w = <Poisoned {...{x: 5, y: "2"}}/>;
             ~~~~~~~~
!!! error TS2322: Type '{ x: number; y: "2"; }' is not assignable to type 'PoisonedProp'.
!!! error TS2322:   Types of property 'x' are incompatible.
!!! error TS2322:     Type 'number' is not assignable to type 'string'.
    let w1 = <Poisoned {...{x: 5, y: "2"}} X="hi" />;
                                           ~
!!! error TS2322: Type '{ X: string; x: number; y: "2"; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'.
!!! error TS2322:   Property 'X' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Poisoned> & PoisonedProp & { children?: ReactNode; }'. Did you mean 'x'?