pomber / code-surfer

Rad code slides <🏄/>
https://codesurfer.pomb.us/
MIT License
6.36k stars 174 forks source link

`code-surfer-types` missing from published package #116

Open karlhorky opened 3 years ago

karlhorky commented 3 years ago

It seems like the code-surfer-types module is missing from the published package:

Screen Shot 2021-05-16 at 12 29 14

And installing it using npm / yarn doesn't work either:

yarn add --dev code-surfer-types
yarn add v1.22.10
[1/4] 🔍  Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/code-surfer-types: Not found".
info If you think this is a bug, please open a bug report with the information provided in "/Users/k/p/courses/slide-decks-new/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
karlhorky commented 3 years ago

Workaround for anyone if this doesn't get fixed anytime soon:

Add the following file to your project with the contents of types.d.ts, which are missing from the published package:

code-surfer-types.d.ts

type Maybe<T> = T | null | undefined;

declare module "code-surfer-types" {
  export interface InputStep {
    code: string;
    focus?: string;
    title?: { value: string };
    subtitle?: { value: string };
    lang?: string;
  }

  export interface Token {
    type: string;
    content: string;
    focus?: boolean;
    key?: number;
  }

  export interface Line {
    tokens: Token[];
    key: Number;
    content: string;
    focus?: boolean;
    focusPerToken?: boolean;
  }

  export interface Step {
    lines: Line[];
    title?: { value: string };
    subtitle?: { value: string };
    focusCenter: number;
    dimensions?: any;
  }

  type StyleItem = {
    types: string[];
    style: React.CSSProperties;
  };

  type Partial<T> = {
    [P in keyof T]?: T[P];
  };
}

declare module "playhead-types" {
  type Animation<T, R> = (prev: Maybe<T>, next: Maybe<T>, t: number) => R;
  type AnimationConfig<T> = {
    when?: (prev: Maybe<T>, next: Maybe<T>) => boolean;
    stagger?: number;
  };
  type AnimationAndConfig<T, R> = {
    animation: Animation<T, R>;
  } & AnimationConfig<T>;
}

declare module "shell-quote" {
  export function parse(s: string): string[];
}