Measuring gamma-ray burst (GRB) properties in their rest-frame is crucial to understand the physics at work in gamma-ray bursts. This can only be done for GRBs with known redshift. Since redshifts are usually measured from the optical spectrum of the afterglow, correlations between prompt and afterglow emissions may introduce biases in the distribution of rest-frame properties of the prompt emission. Our analysis is based on a sample of 90 GRBs with good optical follow-up and well measured prompt emission. 76 of them have a measure of redshift and 14 have no redshift. We estimate their optical brightness with their R magnitude measured two hours after the trigger and compare the rest frame prompt properties of different classes of GRB afterglow brightness. We find that the optical brightness of GRBs in our sample is mainly driven by their intrinsic afterglow luminosity. We show that GRBs with low and high afterglow optical fluxes have similar Epi , Eiso , Liso , indicating that the rest-frame distributions computed from GRBs with a redshift are not significantly distorted by optical selection effects. However we found that the rest frame T90 distribution is not immune to optical selection effect, which favor the selection of GRBs with longer durations. Finally, we note that GRBs in the upper part of the Epi-Eiso plane have fainter optical afterglows and we show that optical selection effects strongly favor the detection of GRBs with bright afterglows located close or below the best-fit Epi-Eiso relation, whose redshift is easily measurable.