Skip to content

Conversation

@haoqixu
Copy link
Contributor

@haoqixu haoqixu commented Nov 7, 2025

This PR ports tsc --init from Strada.

Fixes #1602

fieldName, _, _ = strings.Cut(jsonTag, ",")
}

if fieldName != "" && fieldName != "init" && fieldName != "help" && fieldName != "watch" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are other options like --all that also have to be dropped. Do we have some preexisting way to identify these rather than hardcoding them?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, no, this is actually straight ported. Fun. That's probably a bug!

// commentedAlways': Always comment this out, even if it's on commandline
// commentedOptional': Comment out unless it's on commandline
const (
commentedNever = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably declare a local type and use iota here.

"moduleDetection": "force",
"skipLibCheck": true,

"declarationDir": "/home/src/workspaces/project/lib",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This path is printed incorrectly; it shouldn't include an absolute path.

Copy link
Member

@jakebailey jakebailey Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might come down to the fact that our compiler options are fully resolved now, whereas the old code was not? In which case, you may need to resolve any path-like options relative to the working directory. But since you're just reflecting over options instead of going via options declarations, I am not sure how simple that is.

Perhaps this means we should change the method to not be like Strada and instead use the options declarations to find values... Which would probably also let us not special case the things I mentioned above.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Initializing tsconfig in VSCode workspace results in error exit code

2 participants