Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Question: how to check it's on server side or client side? #18

@kebot

Description

@kebot

A lot of existing libraries design for Nodejs checking whether it's server side or client side by running typeof window === 'undefined'. But in Deno, window is not undefined.

For example when trying to use typestyle, server will crash with this error message:
image

Because there code check it's a server or not by checking window is undefined or not: https://github.com/typestyle/typestyle/blob/master/src/internal/typestyle.ts#L65

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions