File: tsxSpreadAttributesResolution10.errors.txt

package info (click to toggle)
node-typescript 5.0.4%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 459,116 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (42 lines) | stat: -rw-r--r-- 2,234 bytes parent folder | download | duplicates (5)
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
tests/cases/conformance/jsx/file.tsx(19,23): error TS2322: Type '3' is not assignable to type '2'.
tests/cases/conformance/jsx/file.tsx(20,25): error TS2322: Type 'string' is not assignable to type '2'.
tests/cases/conformance/jsx/file.tsx(21,25): error TS2322: Type '3' is not assignable to type '2'.
tests/cases/conformance/jsx/file.tsx(22,15): error TS2322: Type 'true' is not assignable to type '2'.


==== tests/cases/conformance/jsx/file.tsx (4 errors) ====
    import React = require('react');
    
    interface OptionProp {
        x?: 2
    }
    
    class Opt extends React.Component<OptionProp, {}> {
        render() {
            return <div>Hello</div>;
        }
    }
    
    const obj: OptionProp = {};
    const obj1: OptionProp = {
        x: 2
    }
    
    // Error
    let y = <Opt {...obj} x={3}/>;
                          ~
!!! error TS2322: Type '3' is not assignable to type '2'.
!!! 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<Opt> & OptionProp & { children?: ReactNode; }'
    let y1 = <Opt {...obj1} x="Hi"/>;
                            ~
!!! error TS2322: Type 'string' is not assignable to type '2'.
!!! 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<Opt> & OptionProp & { children?: ReactNode; }'
    let y2 = <Opt {...obj1} x={3}/>;
                            ~
!!! error TS2322: Type '3' is not assignable to type '2'.
!!! 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<Opt> & OptionProp & { children?: ReactNode; }'
    let y3 = <Opt x />;
                  ~
!!! error TS2322: Type 'true' is not assignable to type '2'.
!!! 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<Opt> & OptionProp & { children?: ReactNode; }'