Typescript question

looking for some expert opinion on how to access database within Typescript?

As of now, im researching typescript and wondering if i should move towards typescript in one form or another. I been using PHP which works for me but if typescript is going to make my life easer from a frontend perspective how does one access or integrate php with typescript?

TypeScript is a super set of JavaScript. Meaning it is basically JavaScript with added features. You write TypeScript and through the use of a compiler you compile it back into normal JavaScript. It is not like PHP where it sits on the server side as a program that grants you extra powers of accessing the underlying hardware or operating system.

Now having said that, you can write TypeScript on top of a platform like Node.js and Node.js has access to much more than your typical JavaScript. Node.js has packages that can do things like access file systems, work with databases, make network calls etc.

So in review TypeScript is a superset of JavaScript. You write TypeScript and typically compile it back into JavaScript. TypeScript (as well as JavaScript) can work with platforms like Node.js and gain access to packages that can access databases.

TypeScript is not exactly a direct replacement for things like PHP. I know that is a lot to hear, but when you get into talking TypeScript you are talking about something that is most likely going to be part of a stack of technologies. :slight_smile:

1 Like

If its all Javascript wouldnt the database connection information be available to everybody?

Node.js runs on the server, not in the client.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.