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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
|
=== tests/cases/conformance/types/primitives/string/assignFromStringInterface2.ts ===
interface String {
doStuff(): string;
>doStuff : () => string
}
interface NotString {
doStuff(): string;
>doStuff : () => string
toString(): string;
>toString : () => string
charAt(pos: number): string;
>charAt : (pos: number) => string
>pos : number
charCodeAt(index: number): number;
>charCodeAt : (index: number) => number
>index : number
concat(...strings: string[]): string;
>concat : (...strings: string[]) => string
>strings : string[]
indexOf(searchString: string, position?: number): number;
>indexOf : (searchString: string, position?: number) => number
>searchString : string
>position : number
lastIndexOf(searchString: string, position?: number): number;
>lastIndexOf : (searchString: string, position?: number) => number
>searchString : string
>position : number
localeCompare(that: string): number;
>localeCompare : (that: string) => number
>that : string
match(regexp: string): string[];
>match : { (regexp: string): string[]; (regexp: RegExp): string[]; }
>regexp : string
match(regexp: RegExp): string[];
>match : { (regexp: string): string[]; (regexp: RegExp): string[]; }
>regexp : RegExp
replace(searchValue: string, replaceValue: string): string;
>replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; }
>searchValue : string
>replaceValue : string
replace(searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string;
>replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; }
>searchValue : string
>replaceValue : (substring: string, ...args: any[]) => string
>substring : string
>args : any[]
replace(searchValue: RegExp, replaceValue: string): string;
>replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; }
>searchValue : RegExp
>replaceValue : string
replace(searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string;
>replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; }
>searchValue : RegExp
>replaceValue : (substring: string, ...args: any[]) => string
>substring : string
>args : any[]
search(regexp: string): number;
>search : { (regexp: string): number; (regexp: RegExp): number; }
>regexp : string
search(regexp: RegExp): number;
>search : { (regexp: string): number; (regexp: RegExp): number; }
>regexp : RegExp
slice(start?: number, end?: number): string;
>slice : (start?: number, end?: number) => string
>start : number
>end : number
split(separator: string, limit?: number): string[];
>split : { (separator: string, limit?: number): string[]; (separator: RegExp, limit?: number): string[]; }
>separator : string
>limit : number
split(separator: RegExp, limit?: number): string[];
>split : { (separator: string, limit?: number): string[]; (separator: RegExp, limit?: number): string[]; }
>separator : RegExp
>limit : number
substring(start: number, end?: number): string;
>substring : (start: number, end?: number) => string
>start : number
>end : number
toLowerCase(): string;
>toLowerCase : () => string
toLocaleLowerCase(): string;
>toLocaleLowerCase : () => string
toUpperCase(): string;
>toUpperCase : () => string
toLocaleUpperCase(): string;
>toLocaleUpperCase : () => string
trim(): string;
>trim : () => string
length: number;
>length : number
substr(from: number, length?: number): string;
>substr : (from: number, length?: number) => string
>from : number
>length : number
valueOf(): string;
>valueOf : () => string
[index: number]: string;
>index : number
}
var x = '';
>x : string
>'' : ""
var a: String;
>a : String
var b: NotString;
>b : NotString
a = x;
>a = x : string
>a : String
>x : string
a = b;
>a = b : NotString
>a : String
>b : NotString
b = a;
>b = a : String
>b : NotString
>a : String
b = x;
>b = x : string
>b : NotString
>x : string
x = a; // expected error
>x = a : String
>x : string
>a : String
x = b; // expected error
>x = b : NotString
>x : string
>b : NotString
|