Can/Should you access netsuite record field as sta...
# suitescript
a
Can/Should you access netsuite record field as standard javascript objects?
s
In general, there's just so much more information on each record that creating some large JSON is so much more/unecessary than you need. I would suspect @stalbert to say to use NFT here as well.
😄 1
s
yup - indeed you should not try and access NS records as plain JS objects because they are not plain js objects. Only use the official APIs (which is exactly what NFT does 🙂 )
a
As a n00b what is NFT?
NFT simply surfaces NS records/sublists/subrecords as simply JS objects/collections - but does so only using official apis 🙂
a
Thanks I will check it out. Is it specific to typescript? I only code in javascript.
s
It's written in TypeScript but should be usable just fine from javascript
though I admit I use TypeScript which is a natural fit and gets the most from the type system for early error prevention.
it's fairly addicting to be able to type "rec (dot)" then get full code completion on field names in a strongly typed manner. You'd lose that I suspect in a javascript-only environment, but maybe your IDE would be smart enough to make sense of things
e.g. I think webstorm can apply typing hints even to plain JS files
a
I know this might not be the right place to ask but if I learn typescript will I be able to quickly translate the netsuite documentation examples in javascript to typescript?
s
Yes- in fact you can compile JS files with TypeScript.
a
Is there any specific tutorials to set up a netsuite development environment for typescript?
s
I think someone here has a github repo, but the @netsuite types repo is setup to help get folks started
we have a repo internally all set up for TypeScript/NFT/unit/integration tests but can't share that 😞
a
Are you hiring ;) I am the sole developer in a company that has no idea that I write essential scripts without the business can't run.
As far as they are concerned I add users and roles.