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.
#error TS2550: Property 'assign' does not exist on type 'ObjectConstruct '.
32 messages · Page 1 of 1 (latest)
It's just random code to see if I can get it working or not.
Removing the number type specification doesn't change anything. 😦
that's not what i meant, number should be used over Number for types
unrelated to the issue, just mentioned that as a sidenote
aight
Oh okay, sorry I'm new to this xD! Thank you
can you show your tsconfig?
Here you go:
does es2015 work?
Unfortunately not. 😦
Can you replicate this set-up on your machine or am I uniquely experiencing this?
I'm just calling "tsc script.ts" in the terminal of Visual Studio Code
if you provide arguments, the tsconfig.json won't be used
No way! That was the issue?
so you'd need to do tsc script.ts --lib es2022, or you could specify includes and use plain tsc
yeah
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.
- Get the complete course (zero to hero): https://bit.ly/3ahY7wv
- Subscribe for more TypeScript tutorials like this: https://goo.gl/6PYaGF
JavaScript resources:
- YouTube tutorial: https://youtu.be/W6NZf...
none, just don't provide other arguments
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!!!
you can manually provide --project or -p to specify a tsconfig file manually
if you include them all, yeah
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.
Sweet thank you that helps me a lot.