Why String Templates do not pass CI

My program works completely, however CI fails it at:

export interface FC
{
  offset: `${number}%`;
  ..
}

It claims a TypeScript error: Type expected. Why?

1 thought on “Why String Templates do not pass CI”

  1. What you are looking for are Template Literal Types. However, it is only available with TypeScript >= 4.1

    You should update your TypeScript version in your package.json.

    After that, it should definitely works:

    export interface FC
    {
      offset: `${number}%`;
    }
    
    let valid: FC = {
      offset: '1%'
    }
    
    let invalid: FC = {
      offset: '1'
    }
    
    Reply

Leave a Comment