Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continuation Lines #4

Closed
devcybiko opened this issue Jul 7, 2023 · 3 comments
Closed

Continuation Lines #4

devcybiko opened this issue Jul 7, 2023 · 3 comments

Comments

@devcybiko
Copy link

Can we have lines that span multiple lines? I notice your back-tick string allows newlines inside the quoted string, but how can you create values that are longer than a line in the editor?

Classically a line ending with a back-slash would allow line extension. JSON does not allow this and so a very long string spills off the right-hand-side of the editor.

Since TySon generates JSON, continuation lines would translate to very-long-strings.

@loreto
Copy link
Contributor

loreto commented Jul 7, 2023

@devcybiko I'm not sure if this is what you're asking or not, but because TySON is really TypeScript under the hood, it already supports three different ways of creating strings that are longer than one line:

  1. By using template literals, these include the newline in the resulting string:
{
  field: `
    one
    two
    three
  `
}
  1. By allowing you to manually concatenate strings:
{
  field: 'one' +
    'two' +
    'three',
}
  1. By using a backslash as a line continuation:
{
  field: 'one \
  two \
  three',
}

All of these are already supported. Does that cover your use case?

@devcybiko
Copy link
Author

Thank you, friend. The first one inserts new lines into the text, which is not what I wanted. The other two are what I was looking for.

I'm a little confused when you say "TySON is really TypeScript under the hood" - because the output is not a JavaScript program, but JSON code. As a data definition language, I wouldn't necessarily expect all the abilities of TypeScript to be available in the DDL.

@devcybiko
Copy link
Author

closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants