# \`switch\` on generic types

**URL:** <https://forum.dfinity.org/t/switch-on-generic-types/56891>\
**Category:** Language Support\
**Tags:** Motoko\
**Created:** [September 6, 2025, 2:40am UTC](https://forum.dfinity.org/t/switch-on-generic-types/56891 "2025-09-06T02:40:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![skilesare](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/skilesare/32/5609_2.png) [@skilesare](https://forum.dfinity.org/u/skilesare)\
**Post date:** [September 6, 2025, 2:40am UTC](https://forum.dfinity.org/t/switch-on-generic-types/56891/1 "2025-09-06T02:40:33Z")

</div>

Why can’t I switch over an Any type?

> **[ICP Ninja](https://icp.ninja/i?s=z8MYR)**
>
> ICP Ninja is a browser IDE for creating Internet Computer (ICP) smart contracts. Write and deploy entire applications directly onchain from the browser. Choose from a gallery of example projects to get started.

Is there some way to do this?

My use case is I’m trying to do something with `system func inspect`. I want a bunch of helper functions in my modules(ie ensureDateInFuture\<T, Nat\>(msg)) where T is the Message Type of a system func inspect but the issue is that the type changes every time you add a function so there is no way for me to know inside my function what the ultimate form of the Message Type will be.
