File: objectLiteralThisWidenedOnUse.errors.txt

package info (click to toggle)
node-typescript 4.9.5%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 533,908 kB
  • sloc: javascript: 2,018,330; makefile: 7; sh: 1
file content (22 lines) | stat: -rw-r--r-- 1,234 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
tests/cases/compiler/objectLiteralThisWidenedOnUse.ts(8,21): error TS2345: Argument of type '{ prop1: number; prop2: number; prop3: number; test(): void; accept_foo(foo: Foo): boolean; }' is not assignable to parameter of type 'Foo'.
  Property 'bar' is missing in type '{ prop1: number; prop2: number; prop3: number; test(): void; accept_foo(foo: Foo): boolean; }' but required in type 'Foo'.


==== tests/cases/compiler/objectLiteralThisWidenedOnUse.ts (1 errors) ====
    interface Foo { bar: boolean; }
    
    var GlobalIns = {
      prop1: 1,
      prop2: 2,
      prop3: 3,
      test () {
        this.accept_foo(this);
                        ~~~~
!!! error TS2345: Argument of type '{ prop1: number; prop2: number; prop3: number; test(): void; accept_foo(foo: Foo): boolean; }' is not assignable to parameter of type 'Foo'.
!!! error TS2345:   Property 'bar' is missing in type '{ prop1: number; prop2: number; prop3: number; test(): void; accept_foo(foo: Foo): boolean; }' but required in type 'Foo'.
!!! related TS2728 tests/cases/compiler/objectLiteralThisWidenedOnUse.ts:1:17: 'bar' is declared here.
      },
      accept_foo (foo: Foo): boolean {
        return !!foo && !!foo.bar;
      }
    };