MCPcopy Create free account
hub / github.com/microsoft/typescript-go / AssertNever

Function AssertNever

internal/debug/debug.go:27–43  ·  view source on GitHub ↗
(member any, message ...any)

Source from the content-addressed store, hash-verified

25}
26
27func AssertNever(member any, message ...any) {
28 var msg string
29 if len(message) == 0 {
30 msg = "Illegal value:"
31 } else {
32 msg = fmt.Sprint(message...)
33 }
34 var detail string
35 if m, ok := member.(interface{ KindString() string }); ok {
36 detail = m.KindString()
37 } else if m, ok := member.(fmt.Stringer); ok {
38 detail = m.String()
39 } else {
40 detail = fmt.Sprintf("%v", member)
41 }
42 Fail(fmt.Sprintf("%s %s", msg, detail))
43}
44
45func Assert(value bool, message ...any) {
46 if value {

Calls 4

lenFunction · 0.85
FailFunction · 0.70
StringMethod · 0.65
KindStringMethod · 0.45