Need to provide a type annotation for a variable so that you can call a method on it? Just compare it against a literal of the type you want it to be then throw away the result: let f (x:string)=x.Length let f x=x="";x.Length