question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript Definition

See original GitHub issue

I really want to use this library, but i can’t know how work with it. I trying to do a d.ts file to improve it use but i need some help to know what do with each method and what it receive as parameters. if somebody can help me, i’ll really apreciate it.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:3
  • Comments:57 (42 by maintainers)

github_iconTop GitHub Comments

2reactions
3n-mbcommented, May 11, 2017

Have an update in restricting names of columns, named in foreignKeys:

	interface TableDefinition<Name extends string, Row> {
		name: Name;
		schema: string;
		columns: {[CName in keyof Row]: ColumnDefinition<CName, Row[CName]>};
		isTemporary?: boolean;
		foreignKeys?: {
			table: string,
			columns: (keyof Row)[],
			refColumns: string[],
			onDelete?: 'restrict' | 'cascade' | 'no action' | 'set null' | 'set default';
			onUpdate?: 'restrict' | 'cascade' | 'no action' | 'set null' | 'set default';
		}
	}

When indicating a table, we use that table’s object. When indicating refColumns, we use that table’s object. But columns were free-floating. So, (keyof Rows) narrows space for error.

2reactions
spioncommented, Mar 1, 2017

With the newest mapped types in TypeScript, its actually possible to model node-sql

There is a work-in-progress implementation here: https://github.com/doxout/anydb-sql/blob/4e4c0ff4a7f2efb7f820baaafea1f624f1ae0399/d.ts/anydb-sql.d.ts which can be used as a starting point.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript: JavaScript With Syntax For Types.
TypeScript is a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale. Try TypeScript Now. Online or...
Read more >
TypeScript - Wikipedia
TypeScript is a free and open source programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript and...
Read more >
What is TypeScript? Definition, History, Features and Uses
TypeScript is a strongly typed Object-Oriented open source programming language that builds on JavaScript. It is developed and supported by ...
Read more >
TypeScript - Overview - Tutorialspoint
By definition, “TypeScript is JavaScript for application-scale development.” TypeScript is a strongly typed, object oriented, compiled language.
Read more >
Typescript Definition & Meaning - Merriam-Webster
The meaning of TYPESCRIPT is a typewritten manuscript; especially : one intended for use as printer's copy.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found