Skip to content

refactor(data-types): convert postgres data-types to TS - #13970

Closed
wbourne0 wants to merge 15 commits into
typeify-data-typesfrom
typeify-postgres-data-types
Closed

wbourne0 wants to merge 15 commits into
typeify-data-typesfrom
typeify-postgres-data-types

Conversation

@wbourne0

@wbourne0 wbourne0 commented Jan 19, 2022 •

Copy link
Copy Markdown
Member

Note: This is a child PR of #13799 - it should only be merged into that branch when both this pr and that pr have been approved.

(note: omitted the PR checklist as it isn't really relevant here)

Description Of Change

converts postgres-specific data-types to TS.

Also refactors the data-types to work with the (proposed) format from the master pr, #13799.

@wbourne0 wbourne0 added type: refactor DEPRECATED: replace with the "meta" issue type dialect: postgres For issues and PRs. Things that involve PostgreSQL (and do not involve all dialects). typescript For issues and PRs. Things that involve typescript, such as typings and intellisense. hard For issues and PRs. labels Jan 19, 2022
@wbourne0 wbourne0 self-assigned this Jan 19, 2022
@wbourne0
wbourne0 force-pushed the typeify-postgres-data-types branch 2 times, most recently from 495d9fd to 80014bd Compare January 19, 2022 06:07
@wbourne0
wbourne0 force-pushed the typeify-postgres-data-types branch from 80014bd to 137bc03 Compare January 19, 2022 06:40
@wbourne0 wbourne0 added status: awaiting maintainer and removed hard For issues and PRs. labels Jan 19, 2022
Comment thread lib/dialects/postgres/data-types.ts Outdated
import range from './range';

const kSetDialectNames: SetDialectNamesSymbol = Symbol.for(
'sequelize.internal.data-types.set-dialect-names',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a nit but I'd rather internal symbols were exported under an explicitly internal namespace rather than using the Symbol registry.

As I understand it this using the registry so third-party dialects can access the symbol?
If so I'd rather we exposed it under import { SetDialectNamesSymbol } from 'sequelize/dialect-toolbox'. What do you think?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand it this using the registry so third-party dialects can access the symbol?

More or less. I intentionally wasn't exporting it since its not intended for user apis, but that'd be work too.

Comment thread lib/dialects/postgres/data-types.ts Outdated

const warn = BaseTypes.ABSTRACT.warn.bind(
undefined,
'http://www.postgresql.org/docs/9.4/static/datatype.html',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'http://www.postgresql.org/docs/9.4/static/datatype.html',
'https://www.postgresql.org/docs/9.4/static/datatype.html',

Comment thread lib/dialects/postgres/data-types.ts Outdated
return 'BOOLEAN';
}

protected override _sanitize(value: RawTypeOf<DataTypes['BOOLEAN']>): any {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is override removed when d.ts files are generated? Otherwise it won't be compatible with TS < 4.3

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uncertain, its not needed here though so I think I'll just remove it.

@wbourne0
wbourne0 force-pushed the typeify-postgres-data-types branch from 137bc03 to e794607 Compare January 21, 2022 03:36
@github-actions github-actions Bot added the stale label Feb 5, 2022
@wbourne0 wbourne0 removed the stale label Feb 10, 2022
@wbourne0
wbourne0 force-pushed the typeify-postgres-data-types branch from e794607 to 826d7b4 Compare March 5, 2022 02:16
@wbourne0
wbourne0 force-pushed the typeify-postgres-data-types branch from 826d7b4 to 2f5cf3e Compare March 12, 2022 05:14
@wbourne0
wbourne0 force-pushed the typeify-data-types branch from 6de690b to 210279c Compare March 12, 2022 05:20
@ephys ephys mentioned this pull request May 13, 2022
38 of 42 tasks
@wbourne0

Copy link
Copy Markdown
Member Author

Closing in favor of #14505.

@wbourne0 wbourne0 closed this Sep 16, 2022
@ephys
ephys deleted the typeify-postgres-data-types branch October 3, 2022 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dialect: postgres For issues and PRs. Things that involve PostgreSQL (and do not involve all dialects). type: refactor DEPRECATED: replace with the "meta" issue type typescript For issues and PRs. Things that involve typescript, such as typings and intellisense.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants