Impedance as the math law between current and voltage is generalized with Laplace Transforms to arbitary currents and voltages - no need even be periodic ones. For example an inductor with inductance L has Laplace domain impedance =sL where s is the complex number variable used in Laplace transforms. Of course, it's not useful to calculate the numeric value of sL except in certain special cases. That useful case is fixed frequency sine voltages and currents as you obviously guessed. The sL is used in formula derivations.
Impedance is used in a mathematically rigorous way more widely than in electric circuits. It's known in acoustics and electromagnetic field theory. For ex. the vacuum and approximately also plain air in radio frequencies have electromagnetic wave impedance about 377 ohm which is the ratio of the electric and magnetic field strengths which belong to the same wave in the same point at the same moment of time. There's no demand of sinusoidal time domain wave forms.
Then in lousy everyday talk we can say for ex. "the speaker has 8 ohm impedance". We talk about a nominal value. With a certain sinusoidal voltage the actual electric impedance may be that 8 ohm, but generally it's something else depending on frequency. We call it still 8 ohm speaker.