text: import { createCancellationToken } from "../createCancellationToken.js"
  
  export const createOperation = ({
    cancellationToken = createCancellationToken(),
    start,
    ...rest
  }) => {
    const unknownArgumentNames = Object.keys(rest)
    if (unknownArgumentNames.length) {
      throw new Error(`createOperation called with unknown argument names.
  --- unknown argument names ---
  ${unknownArgumentNames}
  --- possible argument names ---
  cancellationToken
  start`)
    }
  
    cancellationToken.throwIfRequested()
    const promise = new Promise((resolve) => {
      resolve(start())
    })
    const cancelPromise = new Promise((resolve, reject) => {
      const cancelRegistration = cancellationToken.register((cancelError) => {
        cancelRegistration.unregister()
        reject(cancelError)
      })
      promise.then(cancelRegistration.unregister, () => {})
    })
    const operationPromise = Promise.race([promise, cancelPromise])
  
    return operationPromise
  }
  