TypeScript/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt
Wenlu Wang ec114b8931
Import assertion (#40698)
* Add parsing

* fix all api

* check gramma of import call

* Add more part of assertion

* Add some case

* Add baseline

* use module insted of target

* strip assertion in d.ts

* Update new baseline

* accept baseline

* Revert error number changes

* Update diagnostic message

* Accept baseline

* rename path

* Fix cr issues

* Accept baseline

* Accept baseline

* Error if assertion and typeonly import

* Accept baseline

* Make lint happy

* Add some comment

* Fix cr issues

* Fix more issue

* Incorporate PR feedback, fix module resolution for import()

* Add contextual type and completions for ImportCall options argument

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
2021-09-20 14:15:22 -07:00

54 lines
2.1 KiB
Plaintext

tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(22,7): error TS2339: Property 'method' does not exist on type '{}'.
tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(23,5): error TS2349: This expression is not callable.
Type '{}' has no call signatures.
tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(28,7): error TS2551: Property 'mesage' does not exist on type 'Error'. Did you mean 'message'?
tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(33,7): error TS2551: Property 'getHuors' does not exist on type 'Date'. Did you mean 'getHours'?
==== tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts (4 errors) ====
declare var x: any;
declare function isFunction(x): x is Function;
declare function isObject(x): x is Object;
declare function isAnything(x): x is {};
declare function isError(x): x is Error;
declare function isDate(x): x is Date;
if (isFunction(x)) { // 'any' is not narrowed when target type is 'Function'
x();
x(1, 2, 3);
x("hello!");
x.prop;
}
if (isObject(x)) { // 'any' is not narrowed when target type is 'Object'
x.method();
x();
}
if (isAnything(x)) { // 'any' is narrowed to types other than 'Function'/'Object' (including {})
x.method();
~~~~~~
!!! error TS2339: Property 'method' does not exist on type '{}'.
x();
~
!!! error TS2349: This expression is not callable.
!!! error TS2349: Type '{}' has no call signatures.
}
if (isError(x)) {
x.message;
x.mesage;
~~~~~~
!!! error TS2551: Property 'mesage' does not exist on type 'Error'. Did you mean 'message'?
!!! related TS2728 /.ts/lib.es5.d.ts:1023:5: 'message' is declared here.
}
if (isDate(x)) {
x.getDate();
x.getHuors();
~~~~~~~~
!!! error TS2551: Property 'getHuors' does not exist on type 'Date'. Did you mean 'getHours'?
!!! related TS2728 /.ts/lib.es5.d.ts:783:5: 'getHours' is declared here.
}