Given the Fourier series \begin{align} f_0(x)=1 \\ f_1(x)=\cos(x)\\ f_2(x)=\sin(x) \\ f_3(x)=\cos(2x)\\ f_4(x)=\sin(2x) \\ f_5(x)=\cos(3x)\\ f_6(x)=\sin(3x) \\ \cdots \end{align} where $x\in [-\pi, \pi]$, can one approximate a non-periodic function (e.g. $y=x/10, x\in [-\pi, \pi]$) with a linear combination $$ y(x) =\sum_i a_i f_i(x) $$ ?
As I understand, all Fourier series here satisfy
$$
f_i(-\pi)= f_i(\pi)
$$
then $y(-\pi)= y(\pi)$ holds, which means that $y(x)$ is periodic.
The question is : approximate in what sense? If you want to approximate in the pointwise sense then you have to assume that $f$ is periodic. But there are other types of approximations. Any square integrable function can be approximated by the partial sums $s_n$ of a series of above type in the sense $\int |f-s_n|^{2} \to 0$. No periodicity is required for this.