Is there a way to know the type of expr in macro to put as a return value of generated function

Or maybe the other way of extending the utils for strings and slices inside macro.

I had post about related topic here, but it's kind of a different issue.

I wanted to extend my serde_default_utils with string and slices, but the result is weird.

So this is what I came up with, and this kind of works? but not entirely
can anyone proficient with macro help to understand if this is even possible?

The answer to the question in the title is no, because type information isn't known when macros are expanded.

And your playground link doesn't have any content.

fixed the link. New playground caching can play weird games.
So my problem currently that I'm trying to have at least some sort of usability for strings and slices, is this possible?

Not completely sure what your desired solution would look like but if you just don't want to write out the type &'static str or &'static [u8] then you could use something like this:

#[macro_export]
macro_rules! serde_default {
    ($kind:ty) => {
        ::paste::paste! {
            pub const fn [<default_$kind:lower>]<const V: $kind>() -> $kind {
                V
            }
        }
    };
    ($name:ident,$text:literal) => {
        ::paste::paste! {
            pub const fn [<default_$name:lower>]() -> &'static ::core::primitive::str {
                $text
            }
        }
    };
    ($name:ident, &[ $($value:expr),* $(,)? ]) => {
        ::paste::paste! {
            pub const fn [<default_$name:lower>]() -> &'static [::core::primitive::u8] {
                &[$($value,)*]
            }
        }
    };
}