Wrap long template literal line to multiline without creating a new line in the string

后端 未结 9 1417
谎友^
谎友^ 2020-12-01 02:40

In es6 template literals, how can one wrap a long template literal to multiline without creating a new line in the string?

For example, if you do this:



        
9条回答
  •  臣服心动
    2020-12-01 03:09

    Similar to Doug's answer this is accepted by my TSLint config and remains untouched by my IntelliJ auto-formatter:

    const text = `a very long string that just ${
      continues
    } and ${continues} and ${continues}`
    

提交回复
热议问题