Check that a ValueNode is compatible with the given type before attempting to create it.