Hi All, Does Access level modifiers like public, p...
# suitescript
c
Hi All, Does Access level modifiers like public, private inside class will not work in Suitescript 2.1? When I use it I'm getting weird errors. Any ideas?
s
Share a code example?
c
class Test { private static instance: Test private constructor(){ } static get instance(){ If(this.instance){ return this.instance(); } this.instance = new Test(); return this.instance(); } }
@Shawn Talbert basically I have implemented the singleton design pattern but the access modifiers are not supporting in Suitescript 2.1.
s
that looks like TypeScript?
If so, you need to upload your transpiled JS file, not the TS file.
c
I declared the instance variable type. Even though if I add instance = null; I'm seeing the same error. Do you have idea If Suitescript 2.1 supports access level modifiers ?
s
Javascript does not support those modifiers AFAIK
but TypeScript does
c
Got it. Thankyou Shawn. I will try using typescript
s
What language do you think you're coding? That looks like TypeScript (TS) to me, so you should be transpiling it to JS. That's the typical way TS is used.
This library would help you get started - it's the de-facto standard library of type definitions for NS functionality.
c
Thanks @Shawn Talbert . I will try with this npm package. I got the answer.
s
If you want a familiar programming paradigm if you like OO, try NFT https://github.com/ExploreConsulting/netsuite-fasttrack-toolkit-ss2
❤️ 1
I write all my scripts using TypeScript and a combination of OO/FP using NFT.
❤️ 1
c
That's fantastic. Thanks for sharing!
👍 1
@Shawn Talbert - This NFT module is really awesome. It makes life easier. Thanks for sharing. I have one question - Does Lazy search and Governance methods will work for the results object that is returned by the sql query?
s
@Charan nay, the lazy search stuff is currently only for
N/search
style searches. Doing similar for SuiteQL searches has been brought up, and would be a nice addition. I think that at least for our team, we're using SuiteQL most often with simple searches that have less than 4000 results - and
asMappedResults
native method provides a similar experience (though, not lazy evaluation).
❤️ 1