Skip to content

[tfjs-node] replace deprecated utils - #8425

Merged
mattsoulanille merged 2 commits into
tensorflow:masterfrom
tharvik:fix-node23
Apr 23, 2025
Merged

[tfjs-node] replace deprecated utils#8425
mattsoulanille merged 2 commits into
tensorflow:masterfrom
tharvik:fix-node23

Conversation

@tharvik

@tharvik tharvik commented Oct 25, 2024

Copy link
Copy Markdown
Contributor

after been marked as deprecated in node 22, node 23 removed nearly all its util.is* functions. so using the node backend in 23 fails quite loudly with some "TypeError: util_1.isNullOrUndefined is not a function".

this PR replace the few places where theses functions were used with node's recommended fixes. or with nullish-coalescing where appropriate.

@andresribeiro

Copy link
Copy Markdown

+1

@Ananthusubramanian

Copy link
Copy Markdown

+1

@domdomegg

Copy link
Copy Markdown

@mattsoulanille can you review this? The fix looks correct and it blocks being able to use tfjs-node on Node >=23.

@mrddter

mrddter commented Mar 7, 2025

Copy link
Copy Markdown

any news on this?

@barroudjo

barroudjo commented Mar 11, 2025

Copy link
Copy Markdown

Same thing, on node 23 (and above) this is absolutely needed. Is there a reason for it not being merged ?

@bubbatls

Copy link
Copy Markdown

+1
Please

@mattsoulanille

Copy link
Copy Markdown
Member

Thanks! We're currently changing our CI config, so I've run this locally to verify it passes.

@mattsoulanille
mattsoulanille merged commit f2e5572 into tensorflow:master Apr 23, 2025
@tharvik
tharvik deleted the fix-node23 branch April 23, 2025 21:10
@chr4ss12

chr4ss12 commented Sep 10, 2025

Copy link
Copy Markdown

why is this still not released?

Added this to my project:

// nice hack to support tensorflow,
// in future tensorflow package upgrade should not need these functions anymore.
// #8425
const util = require('util');
if (!util.isNullOrUndefined) {
util.isNullOrUndefined = (val: any): val is null | undefined => {
return val === null || val === undefined;
};
}

if (!util.isArray) {
util.isArray = (val: any): val is any[] => {
return Array.isArray(val);
};
}

eeerin pushed a commit to eeerin/tfjs that referenced this pull request Dec 8, 2025
Co-authored-by: Matthew Soulanille <msoulanille@google.com>
beenotung added a commit to beenotung/tensorflow-helpers that referenced this pull request Feb 3, 2026
beenotung added a commit to beenotung/image-dataset that referenced this pull request Feb 3, 2026
beenotung added a commit to beenotung/image-dataset that referenced this pull request Feb 3, 2026
beenotung added a commit to beenotung/image-dataset that referenced this pull request Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants