#error TS2550: Property 'assign' does not exist on type 'ObjectConstruct '.

32 messages · Page 1 of 1 (latest)

molten wharf
#

Hi, new to TypeScript here. I'm getting the error provided in the title and pictures when trying to use Object.Assign. I have declared the "lib": ["ES2022"] in the tsconfig.json as specified by the error but the error still crops up. Anyone have any idea's why this would be happending? Google results yield no help as they suggest adding the "lib": ["ES2022"] which I've already done.

#

Folder structure if anyone needs that too.

solid summit
#

shouldn't be using Number btw

#

what's the purpose of that code even?

molten wharf
#

It's just random code to see if I can get it working or not.

#

Removing the number type specification doesn't change anything. 😦

solid summit
#

that's not what i meant, number should be used over Number for types

#

unrelated to the issue, just mentioned that as a sidenote

molten wharf
#

Oh okay, sorry I'm new to this xD! Thank you

solid summit
#

can you show your tsconfig?

molten wharf
#

Here you go:

solid summit
#

does es2015 work?

molten wharf
#

Unfortunately not. 😦

#

Can you replicate this set-up on your machine or am I uniquely experiencing this?

solid summit
#

currently testing

#

ah how exactly are you running tsc?

molten wharf
#

I'm just calling "tsc script.ts" in the terminal of Visual Studio Code

solid summit
#

if you provide arguments, the tsconfig.json won't be used

molten wharf
#

No way! That was the issue?

solid summit
#

so you'd need to do tsc script.ts --lib es2022, or you could specify includes and use plain tsc

solid summit
molten wharf
#

How do you automatically include the tsconfig.json file to the tsc? What's the syntax?

#

I've been following https://www.youtube.com/watch?v=d56mG7DezGs and that was how he was compiling it...

TypeScript Tutorial for Beginners. Learn TypeScript to write better large-scale JavaScript apps. This tutorial helps you get started quickly.

JavaScript resources:

▶ Play video
solid summit
molten wharf
#

What happends when you have multiple TypeScript files? Does it just compile them all

#

Ahh anyway thank you for helping me. This was a real headscratcher. My questions can be answered by google probably. Thanks!!!

solid summit
#

you can manually provide --project or -p to specify a tsconfig file manually

solid summit
#

try checking npm exec tsc -- --help

#
COMMON COMMANDS

  tsc
  Compiles the current project (tsconfig.json in the working directory.)

  tsc app.ts util.ts
  Ignoring tsconfig.json, compiles the specified files with default compiler options.

  tsc -b
  Build a composite project in the working directory.

  tsc --init
  Creates a tsconfig.json with the recommended settings in the working directory.

  tsc -p ./path/to/tsconfig.json
  Compiles the TypeScript project located at the specified path.

  tsc --help --all
  An expanded version of this information, showing all possible compiler options

  tsc --noEmit
  tsc --target esnext
  Compiles the current project, with additional settings.
molten wharf
#

Sweet thank you that helps me a lot.