Lines Matching full:foo*

70   foo(str: string) {
87 foo(str: string) {
128 function foo(fn: I) {
132 foo((value: string) => {
143 function foo(fn: I) {
147 foo((value: string) => {
220 function foo(data: { [key: string]: string }) {
230 function foo(data: Record<string, string>) {
578 function foo(obj: { [key: string]: string}): string {
589 function foo(obj: Record<string, string>): string {
626 foo(value: number): number
629 let t:T = { foo: (value) => { return value } };
636 foo: (value: number) => number
639 let t:T = { foo: (value) => { return value } };
646 foo: (value: number) => number = (value: number) => {
700 function foo(name: string, option: I): void;
709 test.foo('', option);
722 function foo(name: string, option: I): void;
731 test.foo('', option);
736 The object literal lacks a type. According to the analysis of **test.foo**, the **option** type comes from the declaration file. Therefore, you only need to import the type.
1069 function foo() {
1074 foo.apply(obj);
1088 foo() {
1094 obj.foo();
1102 function foo(obj: Test) {
1111 foo(obj);
1118 function foo(value: string) {
1127 foo(obj.value);
1137 static foo(): number {
1148 static foo(): number {
1166 function foo(): I;
1175 ...test.foo(),
1190 function foo(): I;
1198 let t: test.I = test.foo();
1305 foo(): void {
1326 foo(): void {
1363 foo: Function = () => {}
1370 foo: this.foo.bind(this)
1373 foo() {
1384 foo: Function = () => {}
1391 foo: (): void => this.foo()
1394 foo() {
1405 foo: Function = () => {}
1410 foo: () => void = () => {
1415 foo: this.foo
1431 foo() {
1439 a1.foo();
1440 a1.foo.apply(a2);
1452 foo() {
1453 this.fooApply(this);
1456 fooApply(a: A) {
1464 a1.foo();
1465 a1.fooApply(a2);
1476 ['foo', 123],
1487 ['foo', 123],
1575 function foo(n: number) {
1584 let a:A = foo(getNumber());
1594 function foo(n: number) {
1604 let a: A | null = foo(getNumber());
1656 function foo(fn: (value?: string) => void, value: string): void {}
1658 foo((value: string) => {}, ''); //error
1664 function foo(fn: (value?: string) => void, value: string): void {}
1666 foo((value?: string) => {}, '');
1671 In the following example, if strict function type check is not enabled during compilation, the code can be compiled successfully, but unexpected behavior occurs at run time. Specifically, in the function body of **foo**, an **undefined** is passed in to **fn** (this is acceptable because **fn** can accept **undefined**). However, at the invoking point of **foo** in line 6 of the code, in the passed function implementation of **(value: string) => { console.log(value.toUpperCase()) }**, the **value** parameter is always of the string type and can call the **toUpperCase** method. If strict function type check is not enabled, an error indicating that the property cannot be found on **undefined** occurs at run time.
1674 function foo(fn: (value?: string) => void, value: string): void {
1679 foo((value: string) => { console.log(value.toUpperCase()) }, ''); // Cannot read properties of undefined (reading 'toUpperCase')
1780 function foo(v: number): A | null {
1787 let a: A = foo();
1792 Change the type of variable **a** to **let a: A | null = foo()**.
1802 function foo(v: number): A | null {
1809 let a: A | null = foo(123);
1820 If you can determine that a non-null value is returned when **foo** is called, you can use a non-null assertion operator **!**.
1830 function foo(v: number): A | null {
1837 let a: A = foo(123)!;
1846 foo?: () => void
1849 let a:A = { foo: () => {} };
1850 a.foo();
1857 foo: () => void
1859 let a: A = { foo: () => {} };
1860 a.foo();
1867 foo?: () => void
1870 let a: A = { foo: () => {} };
1871 if (a.foo) {
1872 a.foo();
1878 In the original code definition, **foo** is an optional property and may be **undefined**. If **undefined** is called, an error is reported. You are advised to determine whether a property is optional based on the service logic. If defining an optional property is necessary, a null check is required for accessing the property.
1930 function foo(a: number): number {
1944 function foo(a: number): number | undefined {
2121 function foo(value: number): void {
2125 foo.add = (left: number, right: number) => {
2129 foo.sub = (left: number, right: number) => {
2137 class Foo {
2138 static foo(value: number): void {
2158 declare function foo(): any;
2161 let e0: ESObject = foo();
2164 let e1 = foo();
2175 declare function foo(): any;
2181 let e0: ESObject = foo();
2182 let e1: ESObject = foo();