Skip to content

Add braces refactor: Cannot read property 'pos' of undefined #25638

Description

@cevek

TypeScript Version: 3.0.0-dev.20180712

Search Terms:

Code

TypeError: Cannotreadproperty'pos'ofundefinedatindentMultilineCommentOrJsxText(/usr/local/lib/node_modules/typescript/lib/tsserver.js:101971:142)atprocessChildNode(/usr/local/lib/node_modules/typescript/lib/tsserver.js:101724:25)atprocessChildNodes(/usr/local/lib/node_modules/typescript/lib/tsserver.js:101762:48)at/usr/local/lib/node_modules/typescript/lib/tsserver.js:101664:21atvisitNodes(/usr/local/lib/node_modules/typescript/lib/tsserver.js:15128:24)atObject.forEachChild(/usr/local/lib/node_modules/typescript/lib/tsserver.js:15510:21)atprocessNode(/usr/local/lib/node_modules/typescript/lib/tsserver.js:101661:20)atprocessChildNode(/usr/local/lib/node_modules/typescript/lib/tsserver.js:101721:21)atprocessChildNodes(/usr/local/lib/node_modules/typescript/lib/tsserver.js:101762:48)at/usr/local/lib/node_modules/typescript/lib/tsserver.js:101664:21atvisitNodes(/usr/local/lib/node_modules/typescript/lib/tsserver.js:15128:24)atObject.forEachChild(/usr/local/lib/node_modules/typescript/lib/tsserver.js:15510:21)atprocessNode(/usr/local/lib/node_modules/typescript/lib/tsserver.js:101661:20)atprocessChildNode(/usr/local/lib/node_modules/typescript/lib/tsserver.js:101721:21)atprocessChildNodes(/usr/local/lib/node_modules/typescript/lib/tsserver.js:101762:48)at/usr/local/lib/node_modules/typescript/lib/tsserver.js:101664:21atvisitNodes(/usr/local/lib/node_modules/typescript/lib/tsserver.js:15128:24)atObject.forEachChild(/usr/local/lib/node_modules/typescript/lib/tsserver.js:15510:21)atprocessNode(/usr/local/lib/node_modules/typescript/lib/tsserver.js:101661:20)atprocessChildNode(/usr/local/lib/node_modules/typescript/lib/tsserver.js:101721:21)at/usr/local/lib/node_modules/typescript/lib/tsserver.js:101662:21atvisitNode(/usr/local/lib/node_modules/typescript/lib/tsserver.js:15123:24)atObject.forEachChild(/usr/local/lib/node_modules/typescript/lib/tsserver.js:15319:24)atprocessNode(/usr/local/lib/node_modules/typescript/lib/tsserver.js:101661:20)atprocessChildNode(/usr/local/lib/node_modules/typescript/lib/tsserver.js:101721:21)at/usr/local/lib/node_modules/typescript/lib/tsserver.js:101662:21atvisitNode(/usr/local/lib/node_modules/typescript/lib/tsserver.js:15123:24)atObject.forEachChild(/usr/local/lib/node_modules/typescript/lib/tsserver.js:15396:24)atprocessNode(/usr/local/lib/node_modules/typescript/lib/tsserver.js:101661:20)atprocessChildNode(/usr/local/lib/node_modules/typescript/lib/tsserver.js:101721:21)atprocessChildNodes(/usr/local/lib/node_modules/typescript/lib/tsserver.js:101762:48)at/usr/local/lib/node_modules/typescript/lib/tsserver.js:101664:21atvisitNodes(/usr/local/lib/node_modules/typescript/lib/tsserver.js:15128:24)atObject.forEachChild(/usr/local/lib/node_modules/typescript/lib/tsserver.js:15356:24)atprocessNode(/usr/local/lib/node_modules/typescript/lib/tsserver.js:101661:20)atformatSpanWorker(/usr/local/lib/node_modules/typescript/lib/tsserver.js:101488:17)at/usr/local/lib/node_modules/typescript/lib/tsserver.js:101452:140atObject.getFormattingScanner(/usr/local/lib/node_modules/typescript/lib/tsserver.js:100257:23)atObject.formatNodeGivenIndentation(/usr/local/lib/node_modules/typescript/lib/tsserver.js:101452:31)atgetFormattedTextOfNode(/usr/local/lib/node_modules/typescript/lib/tsserver.js:103388:45)atformat(/usr/local/lib/node_modules/typescript/lib/tsserver.js:103366:52)atcomputeNewText(/usr/local/lib/node_modules/typescript/lib/tsserver.js:103369:23)at/usr/local/lib/node_modules/typescript/lib/tsserver.js:103343:89atArray.map(native)at/usr/local/lib/node_modules/typescript/lib/tsserver.js:103342:50atArray.map(native)atObject.getTextChangesFromChanges(/usr/local/lib/node_modules/typescript/lib/tsserver.js:103328:86)atChangeTracker.getChanges(/usr/local/lib/node_modules/typescript/lib/tsserver.js:103305:45)atFunction.ChangeTracker.with(/usr/local/lib/node_modules/typescript/lib/tsserver.js:102881:32)atObject.getEditsForAction(/usr/local/lib/node_modules/typescript/lib/tsserver.js:110202:62)atObject.getEditsForRefactor(/usr/local/lib/node_modules/typescript/lib/tsserver.js:103874:41)atObject.getEditsForRefactor(/usr/local/lib/node_modules/typescript/lib/tsserver.js:111907:32)atIOSession.Session.getEditsForRefactor(/usr/local/lib/node_modules/typescript/lib/tsserver.js:119177:59)atSession.handlers.ts.createMapFromTemplate._a.(anonymousfunction)(/usr/local/lib/node_modules/typescript/lib/tsserver.js:118120:61)at/usr/local/lib/node_modules/typescript/lib/tsserver.js:119389:88atIOSession.Session.executeWithRequestId(/usr/local/lib/node_modules/typescript/lib/tsserver.js:119380:28)atIOSession.Session.executeCommand(/usr/local/lib/node_modules/typescript/lib/tsserver.js:119389:33)atIOSession.Session.onMessage(/usr/local/lib/node_modules/typescript/lib/tsserver.js:119409:35)atInterface.<anonymous>(/usr/local/lib/node_modules/typescript/lib/tsserver.js:120676:27)

Reproduce

<InputFormform={form}submit={data=>[{field: 'email',error: 'Foo'}]}>{({ fields, errors, sending, success })=>(<div>{success&&<div>Success</div>}<InputErrorerrors={errors}/><div><label>Email:</label><InputErrorerrors={fields.email.errors}/><inputtype="email"name="email"required{...fields.email.element}/></div><div><label>Login:</label><InputErrorerrors={fields.login.errors}/><inputtype="text"name="login"requiredminLength={1}maxLength={20}pattern="^[\-\w\d_.$*@]+$"{...fields.login.element}/></div><div><label>Name:</label><InputErrorerrors={fields.name.errors}/><inputtype="text"name="name"required{...fields.name.element}/></div><div><label>Password:</label><InputErrorerrors={fields.password.errors}/><inputtype="password"name="password"minLength={6}{...fields.password.element}/></div><div><inputtype="submit"value="Log In"disabled={sending}/></div></div>)}</InputForm>

ezgif-5-e0b8859caf

Expected behavior:

Actual behavior:

Playground Link:

Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: FormatterThe issue relates to the built-in formatterFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions