I finally figured this one out, it seems that while the documentation says that specifying the filesystem type is optional and normally it is, the parser can't handle a negative number when it's looking for a filesystem type.
If I change the script to specify filesystem types then it works.
parted -s -- /dev/sda mklabel msdos
parted -s -a optimal -- /dev/sda mkpart primary btrfs 1MiB -10GiB
parted -s -a optimal -- /dev/sda mkpart primary linux-swap -10GiB -1s