sapper-template icon indicating copy to clipboard operation
sapper-template copied to clipboard

Handle missing sapper root element

Open lovasoa opened this issue 4 years ago • 0 comments

Before this change, upgrading this project to typescript and enabling strict null checks would throw the following error :

> @rollup/plugin-typescript TS2322: Type 'Element | null' is not assignable to type 'Node'.
  Type 'null' is not assignable to type 'Node'.

4   target: document.querySelector("#sapper"),
    ~~~~~~

  src/node_modules/@sapper/index.d.ts:20:32
    20  export function start(opts: { target: Node }): Promise<void>;
                                      ~~~~~~
    The expected type comes from property 'target' which is declared here on type '{ target: Node; }'

lovasoa avatar May 06 '21 12:05 lovasoa