TypeScript/tests/cases/fourslash/codeFixInferFromUsageCallBodyPriority.ts
Nathan Shively-Sanders 0481d44501
Bad callsite inferences fall back to body usage (#28235)
For parameters, the infer-from-usage codefix uses a substantially
different codepath that previously only looked at call site uses. When
this resulted in no inferences, or bad inferences, for a single
parameter, the codefix would just use any. Only if no usages of a
function were found would the codefix use the body-inference
code.

This commit makes parameter inference fall back to body-inference code
for individual parameters when there is no inference or inference to
any.
2018-10-30 13:25:24 -07:00

19 lines
587 B
TypeScript

/// <reference path='fourslash.ts' />
// based on acorn
////function isIdentifierStart([|code, astral |]) {
//// if (code < 65) { return code === 36 }
//// if (code < 91) { return true }
//// if (code < 97) { return code === 95 }
//// if (code < 123) { return true }
//// if (code <= 0xffff) { return code >= 0xaa }
//// if (astral === false) { return false }
////}
////
////function isLet(nextCh: any) {
//// return isIdentifierStart(nextCh, true)
////};
verify.rangeAfterCodeFix("code: number, astral: boolean",/*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 0);