microsoft/typescript-go · error · ErrClientError

%w: invalid emitOnly value: %d

Error message

%w: invalid emitOnly value: %d

What it means

Error "%w: invalid emitOnly value: %d" thrown in microsoft/typescript-go.

Source

Thrown at internal/api/session.go:2627

	return program, compiler.EmitOptions{
		EmitOnly: emitOnly,
	}, nil
}

func (s *Session) getEmitProgram(snapshot SnapshotID, projectID ProjectID) (*compiler.Program, error) {
	sd, err := s.getSnapshotData(snapshot)
	if err != nil {
		return nil, err
	}
	return sd.getProgram(projectID)
}

func getEmitOnly(value *uint32) (compiler.EmitOnly, error) {
	if value == nil {
		return compiler.EmitAll, nil
	}
	if *value > uint32(compiler.EmitOnlyDts) {
		return compiler.EmitAll, fmt.Errorf("%w: invalid emitOnly value: %d", ErrClientError, *value)
	}
	emitOnly := compiler.EmitOnly(*value)
	return emitOnly, nil
}

func emitProgram(ctx context.Context, program *compiler.Program, options compiler.EmitOptions) (*compiler.EmitResult, error) {
	result := program.Emit(ctx, options)
	if result != nil {
		return result, nil
	}
	if err := ctx.Err(); err != nil {
		return nil, err
	}
	return nil, errors.New("compiler emit returned nil result")
}

func nonNilDiagnostics(diags []*ast.Diagnostic) []*DiagnosticResponse {
	result := NewDiagnosticResponses(diags)

View on GitHub (pinned to 1bcfa18d79)

When it happens

Trigger: Thrown at internal/api/session.go:2627 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16). Data as JSON: /api/errors/2e621f8495a3993b. Report an issue: GitHub.