Next.js Discord

Discord Forum

Best way to import ts or js code as string

Unanswered
Belgian Hare posted this in #help-forum
Open in Discord
Avatar
Belgian HareOP
Hi, I would like to import typescript as a string into another file. I'd like to keep it as a .ts file so that I can have automated tests against the code to ensure it works but I'd primarilly want this code to be in string form as an example in my docs. Any recommendation on how I can achieve this?

2 Replies