Skip to content

Releases: ts-safeql/safeql

@ts-safeql/generate@1.0.0

09 Jul 11:03
22efaa0
Compare
Choose a tag to compare

Major Changes

  • f874247: # Enhanced Nullability Checks

    Previously, SafeQL adopted an optimistic standpoint, presuming a returned column to be non-nullable until established otherwise. Albeit this assumption worked fine in a majority of situations, it occasionally led to false positives. To illustrate, let's take a case of SELECT max(col) FROM .... Previously, such a query returned a non-nullable column, disregarding that the max function could return null if the result set contained no rows (unlike other functions such as count).

    // ❌ Previously, this would be considered non-nullable
    const result = await sql<{ max: number }>`SELECT max(col) FROM tbl WHERE FALSE`;
    
    // ✅ Now, this is considered nullable
    const result = await sql<{ max: number | null }>`SELECT max(col) FROM tbl WHERE FALSE`;
    
    // ✅✅ You could add a fallback via `coalesce` to make it non-nullable again
    const result = await sql<{ max: number }>`SELECT coalesce(max(col), '0') FROM tbl WHERE FALSE`;

    Moreover, the nullability checks for WHERE clauses have been enhanced.

    // ❌ Previously, SafeQL annotated a nullable column as null,
    // even though it was checked for nullability:
    const result = await sql<{ text_nullable: string | null }>`
      SELECT text_nullable FROM tbl WHERE text_nullable IS NOT NULL
    `;
    
    // ✅ Now, SafeQL accurately annotates the column as non-nullable
    const result = await sql<{ text_nullable: string }>`
      SELECT text_nullable FROM tbl WHERE text_nullable IS NOT NULL
    `;

Patch Changes

  • Updated dependencies [f874247]
    • @ts-safeql/shared@0.2.0
    • @ts-safeql/test-utils@0.0.12

@ts-safeql/eslint-plugin@2.0.0

09 Jul 11:03
22efaa0
Compare
Choose a tag to compare

Major Changes

  • f874247: # Enhanced Nullability Checks

    Previously, SafeQL adopted an optimistic standpoint, presuming a returned column to be non-nullable until established otherwise. Albeit this assumption worked fine in a majority of situations, it occasionally led to false positives. To illustrate, let's take a case of SELECT max(col) FROM .... Previously, such a query returned a non-nullable column, disregarding that the max function could return null if the result set contained no rows (unlike other functions such as count).

    // ❌ Previously, this would be considered non-nullable
    const result = await sql<{ max: number }>`SELECT max(col) FROM tbl WHERE FALSE`;
    
    // ✅ Now, this is considered nullable
    const result = await sql<{ max: number | null }>`SELECT max(col) FROM tbl WHERE FALSE`;
    
    // ✅✅ You could add a fallback via `coalesce` to make it non-nullable again
    const result = await sql<{ max: number }>`SELECT coalesce(max(col), '0') FROM tbl WHERE FALSE`;

    Moreover, the nullability checks for WHERE clauses have been enhanced.

    // ❌ Previously, SafeQL annotated a nullable column as null,
    // even though it was checked for nullability:
    const result = await sql<{ text_nullable: string | null }>`
      SELECT text_nullable FROM tbl WHERE text_nullable IS NOT NULL
    `;
    
    // ✅ Now, SafeQL accurately annotates the column as non-nullable
    const result = await sql<{ text_nullable: string }>`
      SELECT text_nullable FROM tbl WHERE text_nullable IS NOT NULL
    `;

Patch Changes

  • Updated dependencies [f874247]
  • Updated dependencies [f874247]
    • @ts-safeql/generate@1.0.0
    • @ts-safeql/shared@0.2.0
    • @ts-safeql/test-utils@0.0.12

@ts-safeql/eslint-plugin@1.1.4

10 Jun 19:23
b2fae60
Compare
Choose a tag to compare

Patch Changes

  • ba02059: Add support for select statements with the following expression (type | null)[]

@ts-safeql/eslint-plugin@1.1.3

09 May 17:04
191dd29
Compare
Choose a tag to compare

Patch Changes

  • 2e681c4: fixed type check when using derived type as override type

@ts-safeql/test-utils@0.0.11

08 May 22:36
5b88a17
Compare
Choose a tag to compare

Patch Changes

  • Updated dependencies [c5b4af1]
    • @ts-safeql/shared@0.1.1

@ts-safeql/shared@0.1.1

08 May 22:36
5b88a17
Compare
Choose a tag to compare

Patch Changes

  • c5b4af1: add support for custom type overrides

@ts-safeql/generate@0.1.1

08 May 22:36
5b88a17
Compare
Choose a tag to compare

Patch Changes

  • c5b4af1: add support for custom type overrides
  • Updated dependencies [c5b4af1]
    • @ts-safeql/shared@0.1.1
    • @ts-safeql/test-utils@0.0.11

@ts-safeql/eslint-plugin@1.1.2

08 May 22:36
5b88a17
Compare
Choose a tag to compare

Patch Changes

  • c5b4af1: add support for custom type overrides
  • Updated dependencies [c5b4af1]
    • @ts-safeql/generate@0.1.1
    • @ts-safeql/shared@0.1.1
    • @ts-safeql/test-utils@0.0.11

@ts-safeql/eslint-plugin@1.1.1

08 May 09:08
cc2b29c
Compare
Choose a tag to compare

Patch Changes

  • 6c15534: fixed an issue where INSERT INTO with a null value was invalid

@ts-safeql/test-utils@0.0.10

07 May 19:22
a4d8a93
Compare
Choose a tag to compare

Patch Changes

  • Updated dependencies [30965b2]
    • @ts-safeql/shared@0.1.0