Skip to main content

Questions tagged [ecmascript-next]

For questions about upcoming ECMAScript features that are not scheduled to be part of a specific version yet (anything that is a stage 3 or lower proposal).

ecmascript-next
0 votes
0 answers
16 views

On running Nest & Typescript API, module cannot be found unless extension explicitly changed to .js

I am working on a personal project to try to get a new dev role. I am using NestJS and Typescript to try to make a simple API (will later hook up some endpoints to a website, just want to show some ...
Allison's user avatar
  • 31
0 votes
2 answers
57 views

Can I have identiers looked up first as members of this, and then as globals?

I write JS (well, EcmaScript), but only relatively rarely. When writing on a member function for an object, I naturally often use other member variables and functions multiple times; but I tend to ...
einpoklum's user avatar
  • 127k
-3 votes
3 answers
184 views

Is there a way to enable a modern "this" scope in a JS module and remove the need for the "this." prefix?

I have the following module class and to make it work similar to non module functional javascript, I have to call a function to bind all the class member functions to the correct this scope and I have ...
1.21 gigawatts's user avatar
1 vote
0 answers
73 views

Use Array.prototype.with in react-native project

I'd like to use Ecmascript 2023 array methods like Array.prototype.with in a react-native project. Are these supported at all, and if so, how can I enable the transformation of those? I am on the ...
uloco's user avatar
  • 2,401
0 votes
1 answer
134 views

UnhandledPromiseRejection while OGM initialize on Neo4j GraphQL Express Server

I am using express with Neo4j graphql. Seeing this exception without specific line indications in my code. node:internal/process/promises:289 triggerUncaughtException(err, true /* ...
Naveen Karnam's user avatar
0 votes
0 answers
59 views

TypeScript 5 - Apply a decorator programatically

Is there a way to apply a decorator programmatically in TypeScript 5? It could be useful to create a decorator function that applies multiple decorators. Previously it was relatively straightforward ...
Ivan Mushketyk's user avatar
4 votes
1 answer
549 views

TypeScript 5 - Access class constructor from a property decorator

In TypeScript 5 the property decorator's type definition has changed and there does not seem to be a way to get a class's constructor. It now implements the TC39 proposal where the first parameter to ...
Ivan Mushketyk's user avatar
13 votes
2 answers
6k views

Why is my regex valid with the RegExp u flag, but not with the v flag and does not work in HTML pattern attribute?

I am getting the below console warning for this regex pattern: ^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9]+\\.[a-zA-Z0-9]+$ Pattern attribute value ^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9]+\.[a-zA-Z0-9]+$ is valid with the ...
DuckSoup's user avatar
  • 159
1 vote
2 answers
582 views

Typescript exclude methods from class once invoked

I have a use case where I want to exclude methods from return type of class method once they are invoked. ie, let us assume I have a class Setup having method step1, step2 and step3. class Setup { ...
Anirudh Modi's user avatar
  • 1,819
5 votes
1 answer
3k views

Need explanation of error message 'TypeError: Receiver must be an instance of class' [duplicate]

When I run this code: 'use strict'; class Base { constructor() { this._public(); } } class Child extends Base { constructor() { super(); } _public() { this.#privateMethod(); ...
d.k's user avatar
  • 4,406
0 votes
1 answer
751 views

sam build outpus cjs file instead of mjs file

When I wanna build my lambda project by using sam cli, it gives me error like below. I use typescript and ES2022 and wait that it should outputs mjs files. But it outputs cjs files. So, cjs files don'...
hkaraoglu's user avatar
  • 1,345
3 votes
3 answers
214 views

How to convert Generator method to an Iterator

I have this recursive generator method which yields the values of a BST in ascending order: *inOrder(node){ if (node === null) { return; } if(node.left){ yield * this....
Alexander Mills's user avatar
0 votes
1 answer
498 views

Copy properties but not function properties, using spread operator or similar

Is there a way in JS to copy all non-function properties using the spread operator or the like? this won't do it obviously (since it will copy function references): getSerializableData(): Partial<...
Alexander Mills's user avatar
0 votes
1 answer
345 views

Can async / await always be automatically replaced by Promises chains?

Usually, Promises chains can be rewritten using async/await const f = () => Promise.resolve(1).then(a => a+1) can be translated to const f = async () => { const a = await ...
Fabiano Taioli's user avatar
3 votes
1 answer
292 views

Does ECMAScript Regular Expressions match its syntax characters?

I'm referring to ECMAScript regular expression syntax defined in https://tc39.es/ecma262/#sec-regexp-regular-expression-objects. I checked how the following pattern matches in a regular expression via ...
BunnyJamless's user avatar

15 30 50 per page
1
2 3 4 5
28