I hate to burst a lot of bubbles on the composition of WD-40, but it does contain "petroleum base oil" (about 15-35 %) and 45-50 % "aliphatic hydrocarbons" (sometimes called mineral spirits). So it contains both oil and solvent (check the product Material Safety Data Sheet).
That being said It is a poor choice to use for lubrication purposes as it's more solvent than oil. The advice given by others not to use for lubricating a bike is right on (except in an extreem emergency!)