# About #32099: remove \`@TypeOf\` and \`anytype\`; introduce \`|T|\` syntax

**URL:** <https://ziggit.dev/t/about-32099-remove-typeof-and-anytype-introduce-t-syntax/15707>\
**Category:** Brainstorming\
**Tags:** language\
**Created:** [May 25, 2026, 5:59am UTC](https://ziggit.dev/t/about-32099-remove-typeof-and-anytype-introduce-t-syntax/15707 "2026-05-25T05:59:08Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![Verafahn](https://ziggit.dev/user_avatar/ziggit.dev/verafahn/32/9285_2.png) [@Verafahn](https://ziggit.dev/u/Verafahn)\
**Post date:** [May 26, 2026, 11:19am UTC](https://ziggit.dev/t/about-32099-remove-typeof-and-anytype-introduce-t-syntax/15707/18 "2026-05-26T11:19:11Z")

</div>

I also thought this was a good practice before:

> [@Traits for Static Dispatch](https://ziggit.dev/t/traits-for-static-dispatch/10819/21):
>
> This method is something I never thought of before. It’s great! If we adopt this approach, we don’t even need to introduce |T| grammar. You can take a look at this example: const std = @import("std"); pub fn satisfyTrait(comptime Trait: type, comptime T: type) R: { if (@typeInfo(Trait) != .@"struct") @compileError("Trait must be an 'struct'."); break :R bool; } { const decls = std.meta.declarations(Trait); inline for (decls) |decl| { if (!std.meta.hasMethod(T, …

So I wrote a library for this purpose:

> [@Use \`trait\` to improve the user experience of \`anytype\`](https://ziggit.dev/t/use-trait-to-improve-the-user-experience-of-anytype/15618):
>
> vftrait A compile-time library for duck type checking. URL: [Verafahn/vftrait](https://github.com/Verafahn/vftrait) idea from [Discussion about |T: Trait|](https://ziggit.dev/t/traits-for-static-dispatch/10819/17).I think this is a good practice, so I wrote this project. This project implements a complete satisfyTrait function. After introducing it, you can define a trait (actually a struct) in the project to constrain anytype. I think this can also be considered as an implementation of compile time polymorphism. satisfyTrait is not simply determining whether a type has the same members …

But when I actually used it for my code, I found that ZLS does not execute the comptime code at this location, which means I cannot directly trigger code completion after it. Meanwhile, Zig also does not allow shadows, which makes it very inconvenient to use.

---

_[View the full topic](https://ziggit.dev/t/about-32099-remove-typeof-and-anytype-introduce-t-syntax/15707)._
