Skip to content

Typescript Syntax Eval Error (False Positive) #1

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

Closed
nomadicGopher opened this issue Jan 7, 2025 · 2 comments
Closed

Typescript Syntax Eval Error (False Positive) #1

nomadicGopher opened this issue Jan 7, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@nomadicGopher
Copy link
Owner

nomadicGopher commented Jan 7, 2025

jonat@anon_laptop MINGW64 ~/go/src/github.com/nomadicGopher/typescript2javascript (main)
$ go run main.go
2025/01/07 00:45:20 TypeScript Code:
let message: string = "Hello, World!";
console.log(message);
2025/01/07 00:45:20 Typescript: SyntaxError: SyntaxError: (anonymous): Line 1:12 Unexpected token :
exit status 1

github.com/clarkmcc/go-typescript

@nomadicGopher nomadicGopher added the bug Something isn't working label Jan 7, 2025
@nomadicGopher nomadicGopher self-assigned this Jan 7, 2025
@nomadicGopher
Copy link
Owner Author

TODO: compile instead of evaluate

jsCode, err := typescript.Compile(tsCode)
if err != nil {
// Handle error
}
// Use jsCode (e.g., write it to a file or send it in an HTTP response)

@nomadicGopher
Copy link
Owner Author

Fixed with typescript.TranspileString(string(tsCode))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant