You are correct that the pattern has a typographical error in the first line. It should tell you to cast on 40 stitches.
When knitting a square or rectangle, there is nothing counterintuitive going on, you are knitting rows back and forth that eventually become the geometric shape of an object with four 90 degree corners. The number of stitches at cast on should represent exactly the number of stitches being knitted in each row thereafter.
There is the very important issue of gauge to bring into the equation. If you are planning to sew your own inner pillow form and stuff it yourself, then you can customize the size of the pillow form to the dimensions of your completed cushion cover. In this case, the issue of gauge is not very important, other than for the look of the fabric itself.
However, if you plan to place the cushion cover onto a pre-purchased pillow form, the finished square would need to be a precise size in order to fit well onto that pillow form. So, it is definitely worth knitting a good-sized swatch (something like a 12 or 13 cm square) in the yarn and stitch pattern you are using for your project, in order to check your gauge and therefore confirm that all your hard work will actually turn out the correct size.
How to determine gauge with a swatch:
[A] Stitches Per Row (Horizontal Gauge): Once you have your gauge swatch knitted, accurately count (down to the 1/2 stitch!) how many stitches there are in 10 cm. We know that the pattern calls for 40 stitches in 30 cm. This would equate to a gauge of 10.3333 stitches in 10 cm. I would round this up to 10.5 stitches in 10 cm.
Examples: If your gauge swatch shows you having say 12 stitches in 10 cm, then you should go up a needle size (use a larger needle to get larger stitches, therefore fewer stitches per 10 cm) in order to precisely achieve that 10.5 stitches per 10 cm. If the swatch shows say 9 stitches in 10 cm, then you would go down a size (use a smaller needle to get smaller stitches, thus more stitches per 10 cm.)
[B] Rows per Length (Vertical Gauge): As for rows, those too should be measured in a 10 cm section of your swatch. It appears to me that the pattern calling for 76 rows (8 starting border rows, a 10-row pattern repeated 6 times, and another 8 row border) over a length of 30 cm: if this is correct, it would equate to a gauge of 25.3 rows per 10 cm. This doesn’t sound right, usually knitted stitches are 4/5 as tall as they are wide (That means that if you cast on a number of stitches, then knit the same number of rows, your knitted swatch will be about 4/5 as tall as it is wide (say 5 inches wide and 4 inches tall,)) which would mean you would need 50 rows, not 76, to make a length equal to the width of 40 cast on stitches. SO, I think given the statement at the end that you knit until there are 50 rows, there is another error elsewhere in the pattern. (I will talk you through this in the final paragraphs below.)
The problem with vertical (row) gauge is that it is much harder to correct the height of your loops, then the width of your loops as in stitches per row. The first priority in gauge really is knitting with the right needle for horizontal (stitch) gauge. So in the case of a rectangle, the ultimate length of the work is better handled by adding or subtracting rows in order to make the piece come out exactly as long as desired.
If the pattern were what we call an “all over pattern” from the first row to the last, you could literally just keep knitting until the piece from cast on to the edge of the loops on your needle measures one row short of your desired length - then the cast off row would complete the precise length you want.
However in your case, this pattern includes a border of 8 rows at the beginning and (I’m assuming? although the pattern is confusing in saying “knit until there are 50 rows”: again, see last paragraph) at the end. So a precise length adjustment will need to occur by adding or subtracting rows somewhere that does not disrupt the design. You can choose to do this either in the central patternwork, or half in the beginning border and half in the ending border (to keep the borders symmetrical,) or a little of both.
ABOUT THE ERRORS IN THIS PATTERN: OK, as reviewed above, in addition to the cast on being wrong, the pattern definitely describes a 76 row design: 8 rows of initial border + 60 rows (6 x 10 row pattern,) + 8 rows of final border. Using the 4/5 rule (stitch height over stitch width), a 40 stitch cast on that is 30 cm wide would become a 30 cm square after 50 rows.
So, what to do?
OPTION A: SEE IF THE DESIGNER HAS PUBLISHED “ERRATA”, WHICH IS KNITSPEAK FOR A CORRECTION TO THE PATTERN: I would definitely contact this designer. If he/she hasn’t already published Errata, it is likely because she hasn’t received the feedback that there are errors. Most of us who design for knitting (or any fiber art) try REALLY REALLY hard to make sure the instructions are perfect, and we’re mortified to discover any error no matter how slight, and will do backflips in order to make it right as quickly as humanly possible.
OPTION B: ALTER THE PATTERN: If you cannot reach the designer, then I would make some decisions. Based on your swatch, you know your rows per 10 cm gauge: confirm exactly how many rows will make a 30 cm length. Then start deciding where to distribute the “border” rows, and the “center stitch design” rows.
For example: say your swatching shows that 50 rows would make a 30 cm length. (The “50 rows” instruction at the end may actually be correct, as it does work out mathematically.) Perhaps you could make a 5 row border, 4 repeats of the 10 row pattern, and finish with a 5 row border. (A total of 50 rows.)
OPTION C: WING IT WITH AN ALL-OVER PATTERN: Depending on how bonded you are with the pattern you are planning, you could consider knitting just the 40-stitch, 10 row stitch pattern, repeating the 10 rows start to finish, and simply stopping as soon as the correct length is reached. (This is what I described above, the third paragraph in section [B].)
ONE FINAL ENCOURAGEMENT: HAND KNITTED OBJECTS ARE VERY FORGIVING: Yes you want to be as precise as possible, because your hands are human hands, and your tension may vary up and down, so attempting to get the dimensions correct through gauge measurements is smart knitting. But there is another side to the coin: you CAN relax! Hand knitted objects tend to be very stretchy (with some exceptions based on stitch pattern and fiber selection.) Given the pattern you are knitting, you may be surprised how stretchy it is. Also when you finish it, you will soak the piece, wrap it in a towel and squeeze out the water, then block it on a flat surface to the dimensions you designed it for. Blocking will make all the difference, you can literally make a piece bend to your will at that stage.
Hope this helps, and that you can enjoy making this project despite some math! I am happy to answer questions in comments or even chat if you need more help!-