microsoft/typescript-go · error

compiler emit returned nil result

Error message

compiler emit returned nil result

What it means

Error "compiler emit returned nil result" thrown in microsoft/typescript-go.

Source

Thrown at internal/api/session.go:2641

	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)
	if result == nil {
		return []*DiagnosticResponse{}
	}
	return result
}

// handleGetIntrinsicType returns an intrinsic type (any, string, number, etc.).
func (s *Session) handleGetIntrinsicType(ctx context.Context, params *GetIntrinsicTypeParams, getter func(*checker.Checker) *checker.Type) (*TypeResponse, error) {
	setup, err := s.setupChecker(ctx, params.Snapshot, params.Project)
	if err != nil {
		return nil, err
	}
	defer setup.done()

View on GitHub (pinned to 1bcfa18d79)

When it happens

Trigger: Thrown at internal/api/session.go:2641 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/51bfcfda7e21bcaa. Report an issue: GitHub.