question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dom lib required for TS to compile in Node app

See original GitHub issue

Describe the bug

Dom lib required by typescript in order to successfully compile node app

Your environment

SDK version number

@aws-sdk/lib-dynamodb@3.36.0

Is the issue in the browser/Node.js/ReactNative?

Node.js

Details of the Node.js

v12.22.4

Steps to reproduce

  • Create a fresh TS workspace
  • Set minimal tsconfig.json and do not include “dom” in lib array
  • Install @aws-sdk/lib-dynamodb@3.36.0
  • import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb"; into hello world file
  • run tsc to compile project

Observed behavior

The source code fails to compile with error: Screen Shot 2021-10-13 at 11 43 12 AM

Expected behavior

lib installed into node app should not require “dom” types to compile

Additional context

If you add “dom” to lib array in tsconfig.json, source code will compile successfully

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:13
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
simonbuchancommented, Oct 14, 2021

Getting typescript isomorphic code to compile without assertions across environments generally sucks, but in the public interface looks something like:

// Declare interfaces that will get merged with the real definitions in lib.dom and @types/node
declare global {
  export interface ReadableStream {}

  export namespace NodeJS {
    export interface Readable {}
  }

  // ...
}

export type InputStream = ReadableStream | NodeJS.Stream;

Really, it’s missing a typescript feature, maybe declare interface ReadableStream {} that evaluates to never if not otherwise defined?

0reactions
github-actions[bot]commented, Sep 14, 2022

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DOM lib still required for TS to compile in Node app #3991
Please create a minimal reproduction repository containing a package.json, tsconfig.json, and sample .ts file to compile. URL has been globally ...
Read more >
It's 2020: let's build a node.js app with TypeScript - Tom Spencer
We therefore only need TypeScript at compile-time - node.js will run the compiled JavaScript files. app.ts. We'll now create the entrypoint for ...
Read more >
How to Set Up a Node.js Project with TypeScript
In this tutorial, you will learn how to add TypeScript support to Node.js projects. We will address common needs, such as: compiling and ......
Read more >
How to compile/build a TypeScript library that uses no NodeJS ...
In this case all you have to do is compile your typescript to something like a /lib and allow them to install and...
Read more >
How to Setup a TypeScript + Node.js Project | Khalil Stemmler
In this short guide, I'll walk you through the process of creating a basic TypeScript application and compiling it.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found