File: controlFlowPropertyDeclarations.types

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (383 lines) | stat: -rw-r--r-- 11,940 bytes parent folder | download
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
=== tests/cases/compiler/controlFlowPropertyDeclarations.ts ===
// Repro from ##8913

declare var require:any;
>require : any

var HTMLDOMPropertyConfig = require('react/lib/HTMLDOMPropertyConfig');
>HTMLDOMPropertyConfig : any
>require('react/lib/HTMLDOMPropertyConfig') : any
>require : any
>'react/lib/HTMLDOMPropertyConfig' : "react/lib/HTMLDOMPropertyConfig"

// Populate property map with ReactJS's attribute and property mappings
// TODO handle/use .Properties value eg: MUST_USE_PROPERTY is not HTML attr
for (var propname in HTMLDOMPropertyConfig.Properties) {
>propname : string
>HTMLDOMPropertyConfig.Properties : any
>HTMLDOMPropertyConfig : any
>Properties : any

  if (!HTMLDOMPropertyConfig.Properties.hasOwnProperty(propname)) {
>!HTMLDOMPropertyConfig.Properties.hasOwnProperty(propname) : boolean
>HTMLDOMPropertyConfig.Properties.hasOwnProperty(propname) : any
>HTMLDOMPropertyConfig.Properties.hasOwnProperty : any
>HTMLDOMPropertyConfig.Properties : any
>HTMLDOMPropertyConfig : any
>Properties : any
>hasOwnProperty : any
>propname : string

    continue;
  }

  var mapFrom = HTMLDOMPropertyConfig.DOMAttributeNames[propname] || propname.toLowerCase();
>mapFrom : any
>HTMLDOMPropertyConfig.DOMAttributeNames[propname] || propname.toLowerCase() : any
>HTMLDOMPropertyConfig.DOMAttributeNames[propname] : any
>HTMLDOMPropertyConfig.DOMAttributeNames : any
>HTMLDOMPropertyConfig : any
>DOMAttributeNames : any
>propname : string
>propname.toLowerCase() : string
>propname.toLowerCase : () => string
>propname : string
>toLowerCase : () => string
}

/**
 * Repeats a string a certain number of times.
 * Also: the future is bright and consists of native string repetition:
 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat
 *
 * @param {string} string  String to repeat
 * @param {number} times   Number of times to repeat string. Integer.
 * @see http://jsperf.com/string-repeater/2
 */
function repeatString(string, times) {
>repeatString : (string: any, times: any) => any
>string : any
>times : any

  if (times === 1) {
>times === 1 : boolean
>times : any
>1 : 1

    return string;
>string : any
  }
  if (times < 0) { throw new Error(); }
>times < 0 : boolean
>times : any
>0 : 0
>new Error() : Error
>Error : ErrorConstructor

  var repeated = '';
>repeated : string
>'' : ""

  while (times) {
>times : any

    if (times & 1) {
>times & 1 : number
>times : any
>1 : 1

      repeated += string;
>repeated += string : string
>repeated : string
>string : any
    }
    if (times >>= 1) {
>times >>= 1 : number
>times : any
>1 : 1

      string += string;
>string += string : any
>string : any
>string : any
    }
  }
  return repeated;
>repeated : string
}

/**
 * Determine if the string ends with the specified substring.
 *
 * @param {string} haystack String to search in
 * @param {string} needle   String to search for
 * @return {boolean}
 */
function endsWith(haystack, needle) {
>endsWith : (haystack: any, needle: any) => boolean
>haystack : any
>needle : any

  return haystack.slice(-needle.length) === needle;
>haystack.slice(-needle.length) === needle : boolean
>haystack.slice(-needle.length) : any
>haystack.slice : any
>haystack : any
>slice : any
>-needle.length : number
>needle.length : any
>needle : any
>length : any
>needle : any
}

/**
 * Trim the specified substring off the string. If the string does not end
 * with the specified substring, this is a no-op.
 *
 * @param {string} haystack String to search in
 * @param {string} needle   String to search for
 * @return {string}
 */
function trimEnd(haystack, needle) {
>trimEnd : (haystack: any, needle: any) => any
>haystack : any
>needle : any

  return endsWith(haystack, needle)
>endsWith(haystack, needle)    ? haystack.slice(0, -needle.length)    : haystack : any
>endsWith(haystack, needle) : boolean
>endsWith : (haystack: any, needle: any) => boolean
>haystack : any
>needle : any

    ? haystack.slice(0, -needle.length)
>haystack.slice(0, -needle.length) : any
>haystack.slice : any
>haystack : any
>slice : any
>0 : 0
>-needle.length : number
>needle.length : any
>needle : any
>length : any

    : haystack;
>haystack : any
}

/**
 * Convert a hyphenated string to camelCase.
 */
function hyphenToCamelCase(string) {
>hyphenToCamelCase : (string: any) => any
>string : any

  return string.replace(/-(.)/g, function(match, chr) {
>string.replace(/-(.)/g, function(match, chr) {    return chr.toUpperCase();  }) : any
>string.replace : any
>string : any
>replace : any
>/-(.)/g : RegExp
>function(match, chr) {    return chr.toUpperCase();  } : (match: any, chr: any) => any
>match : any
>chr : any

    return chr.toUpperCase();
>chr.toUpperCase() : any
>chr.toUpperCase : any
>chr : any
>toUpperCase : any

  });
}

/**
 * Determines if the specified string consists entirely of whitespace.
 */
function isEmpty(string) {
>isEmpty : (string: any) => boolean
>string : any

   return !/[^\s]/.test(string);
>!/[^\s]/.test(string) : boolean
>/[^\s]/.test(string) : boolean
>/[^\s]/.test : (string: string) => boolean
>/[^\s]/ : RegExp
>test : (string: string) => boolean
>string : any
}

/**
 * Determines if the CSS value can be converted from a
 * 'px' suffixed string to a numeric value
 *
 * @param {string} value CSS property value
 * @return {boolean}
 */
function isConvertiblePixelValue(value) {
>isConvertiblePixelValue : (value: any) => boolean
>value : any

  return /^\d+px$/.test(value);
>/^\d+px$/.test(value) : boolean
>/^\d+px$/.test : (string: string) => boolean
>/^\d+px$/ : RegExp
>test : (string: string) => boolean
>value : any
}

export class HTMLtoJSX {
>HTMLtoJSX : HTMLtoJSX

    private output: string;
>output : string

    private level: number;
>level : number

    private _inPreTag: boolean;
>_inPreTag : boolean


  /**
   * Handles processing of the specified text node
   *
   * @param {TextNode} node
   */
  _visitText = (node) => {
>_visitText : (node: any) => void
>(node) => {    var parentTag = node.parentNode && node.parentNode.tagName.toLowerCase();    if (parentTag === 'textarea' || parentTag === 'style') {      // Ignore text content of textareas and styles, as it will have already been moved      // to a "defaultValue" attribute and "dangerouslySetInnerHTML" attribute respectively.      return;    }    var text = ''    if (this._inPreTag) {      // If this text is contained within a <pre>, we need to ensure the JSX      // whitespace coalescing rules don't eat the whitespace. This means      // wrapping newlines and sequences of two or more spaces in variables.      text = text        .replace(/\r/g, '')        .replace(/( {2,}|\n|\t|\{|\})/g, function(whitespace) {          return '{' + JSON.stringify(whitespace) + '}';        });    } else {      // If there's a newline in the text, adjust the indent level      if (text.indexOf('\n') > -1) {      }    }    this.output += text;  } : (node: any) => void
>node : any

    var parentTag = node.parentNode && node.parentNode.tagName.toLowerCase();
>parentTag : any
>node.parentNode && node.parentNode.tagName.toLowerCase() : any
>node.parentNode : any
>node : any
>parentNode : any
>node.parentNode.tagName.toLowerCase() : any
>node.parentNode.tagName.toLowerCase : any
>node.parentNode.tagName : any
>node.parentNode : any
>node : any
>parentNode : any
>tagName : any
>toLowerCase : any

    if (parentTag === 'textarea' || parentTag === 'style') {
>parentTag === 'textarea' || parentTag === 'style' : boolean
>parentTag === 'textarea' : boolean
>parentTag : any
>'textarea' : "textarea"
>parentTag === 'style' : boolean
>parentTag : any
>'style' : "style"

      // Ignore text content of textareas and styles, as it will have already been moved
      // to a "defaultValue" attribute and "dangerouslySetInnerHTML" attribute respectively.
      return;
    }

    var text = ''
>text : string
>'' : ""

    if (this._inPreTag) {
>this._inPreTag : boolean
>this : this
>_inPreTag : boolean

      // If this text is contained within a <pre>, we need to ensure the JSX
      // whitespace coalescing rules don't eat the whitespace. This means
      // wrapping newlines and sequences of two or more spaces in variables.
      text = text
>text = text        .replace(/\r/g, '')        .replace(/( {2,}|\n|\t|\{|\})/g, function(whitespace) {          return '{' + JSON.stringify(whitespace) + '}';        }) : string
>text : string
>text        .replace(/\r/g, '')        .replace(/( {2,}|\n|\t|\{|\})/g, function(whitespace) {          return '{' + JSON.stringify(whitespace) + '}';        }) : string
>text        .replace(/\r/g, '')        .replace : { (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
>text        .replace(/\r/g, '') : string
>text        .replace : { (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
>text : string

        .replace(/\r/g, '')
>replace : { (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
>/\r/g : RegExp
>'' : ""

        .replace(/( {2,}|\n|\t|\{|\})/g, function(whitespace) {
>replace : { (searchValue: string | RegExp, replaceValue: string): string; (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; }
>/( {2,}|\n|\t|\{|\})/g : RegExp
>function(whitespace) {          return '{' + JSON.stringify(whitespace) + '}';        } : (whitespace: string) => string
>whitespace : string

          return '{' + JSON.stringify(whitespace) + '}';
>'{' + JSON.stringify(whitespace) + '}' : string
>'{' + JSON.stringify(whitespace) : string
>'{' : "{"
>JSON.stringify(whitespace) : string
>JSON.stringify : { (value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (string | number)[], space?: string | number): string; }
>JSON : JSON
>stringify : { (value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (string | number)[], space?: string | number): string; }
>whitespace : string
>'}' : "}"

        });
    } else {
      // If there's a newline in the text, adjust the indent level
      if (text.indexOf('\n') > -1) {
>text.indexOf('\n') > -1 : boolean
>text.indexOf('\n') : number
>text.indexOf : (searchString: string, position?: number) => number
>text : string
>indexOf : (searchString: string, position?: number) => number
>'\n' : "\n"
>-1 : -1
>1 : 1
      }
    }
    this.output += text;
>this.output += text : string
>this.output : string
>this : this
>output : string
>text : string
  }



};

/**
 * Handles parsing of inline styles
 */
export class StyleParser {
>StyleParser : StyleParser

  styles = {};
>styles : {}
>{} : {}

  toJSXString = () => {
>toJSXString : () => void
>() => {    for (var key in this.styles) {      if (!this.styles.hasOwnProperty(key)) {      }    }  } : () => void

    for (var key in this.styles) {
>key : string
>this.styles : {}
>this : this
>styles : {}

      if (!this.styles.hasOwnProperty(key)) {
>!this.styles.hasOwnProperty(key) : boolean
>this.styles.hasOwnProperty(key) : boolean
>this.styles.hasOwnProperty : (v: string | number | symbol) => boolean
>this.styles : {}
>this : this
>styles : {}
>hasOwnProperty : (v: string | number | symbol) => boolean
>key : string
      }
    }
  }
}